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();
}
+6 -4
View File
@@ -81,6 +81,12 @@ _ sketches must be removed manually if the debug keystore changes
_ http://code.google.com/p/processing/issues/detail?id=236
_ register(this, "pause") -> libs will need pause events on android
_ add registered methods again
_ need to figure out generic event queueing first
_ may need a different subset of methods, and introduce new ones
_ that will be usable on both android and desktop
_ dispose() was calling disposeMethods.handle(), but they're null
_ thread is continually running - 'inside handleDraw()' running continually
_ inside run() it shouldn't still be going
@@ -188,10 +194,6 @@ _ this is currently draining batteries
X look into touch event code, see if there's a good way to integrate
_ make a decision on how to integrate touch event code
_ add registered methods again
_ need to figure out generic event queueing first
_ may need a different subset of methods, and introduce new ones
_ that will be usable on both android and desktop
_ "Unable to resolve target 'Google...'" when APIs aren't installed
_ add an error message that explains what to do