fix NPE problem since registered methods not properly added back

This commit is contained in:
benfry
2011-03-06 04:45:33 +00:00
parent 9c58edcfd0
commit e17bc46865
2 changed files with 17 additions and 5 deletions
+11 -1
View File
@@ -513,6 +513,15 @@ public class PApplet extends Activity implements PConstants, Runnable {
redraw = true; // draw this guy once
firstMotion = true;
// these need to be inited before setup
sizeMethods = new RegisteredMethods();
preMethods = new RegisteredMethods();
drawMethods = new RegisteredMethods();
postMethods = new RegisteredMethods();
mouseEventMethods = new RegisteredMethods();
keyEventMethods = new RegisteredMethods();
disposeMethods = new RegisteredMethods();
Context context = getApplicationContext();
sketchPath = context.getFilesDir().getAbsolutePath();
@@ -2494,7 +2503,7 @@ public class PApplet extends Activity implements PConstants, Runnable {
* Not to be called or overriden by users. If called multiple times,
* will only notify listeners once. Register a dispose listener instead.
*/
public void dispose(){
public void dispose() {
// moved here from stop()
finished = true; // let the sketch know it is shut down time
@@ -2504,6 +2513,7 @@ public class PApplet extends Activity implements PConstants, Runnable {
// call to shut down renderer, in case it needs it (pdf does)
if (g != null) g.dispose();
disposeMethods.handle();
}