From ebb5c5252df908fadfec97f7e6a85b6fba77f8bc Mon Sep 17 00:00:00 2001 From: benfry Date: Wed, 22 Jun 2011 21:25:41 +0000 Subject: [PATCH] deal with destroy() problem (issue #698), plus edits --- core/src/processing/core/PApplet.java | 14 ++++++++------ core/src/processing/core/PShapeSVG.java | 2 +- core/todo.txt | 21 +++++++++++++-------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 1791c8a56..5bf10f2bf 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -799,7 +799,7 @@ public class PApplet extends Applet * when moving between pages), though. */ public void destroy() { - ((PApplet)this).exit(); + ((PApplet) this).dispose(); } @@ -1600,7 +1600,7 @@ public class PApplet extends Applet // If the user called the exit() function, the window should close, // rather than the sketch just halting. if (exitCalled) { - exit2(); + exitActual(); } } @@ -2585,7 +2585,7 @@ public class PApplet extends Applet if (thread == null) { // exit immediately, dispose() has already been called, // meaning that the main thread has long since exited - exit2(); + exitActual(); } else if (looping) { // dispose() will be called as the thread exits @@ -2600,11 +2600,12 @@ public class PApplet extends Applet dispose(); // now get out - exit2(); + exitActual(); } } - void exit2() { + + void exitActual() { try { System.exit(0); } catch (SecurityException e) { @@ -2612,6 +2613,7 @@ public class PApplet extends Applet } } + /** * Called to dispose of resources and shut down the sketch. * Destroys the thread, dispose the renderer,and notify listeners. @@ -2619,7 +2621,7 @@ public class PApplet extends Applet * 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 diff --git a/core/src/processing/core/PShapeSVG.java b/core/src/processing/core/PShapeSVG.java index 9f694d08b..b655a40ee 100644 --- a/core/src/processing/core/PShapeSVG.java +++ b/core/src/processing/core/PShapeSVG.java @@ -1824,7 +1824,7 @@ public class PShapeSVG extends PShape { * beneath them can be used here. *
    * // This code grabs "Layer 3" and the shapes beneath it.
-   * PShape layer3 = svg.getShape("Layer 3");
+   * PShape layer3 = svg.getChild("Layer 3");
    * 
*/ public PShape getChild(String name) { diff --git a/core/todo.txt b/core/todo.txt index 715f8e4f8..bb9384755 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -67,6 +67,8 @@ o needs to be documented, and excise all screen.width/height references X add to the 'changes' document X saveBytes() error when writing to existing file X http://code.google.com/p/processing/issues/detail?id=667 +X destroy() in PApplet ultimately calls System.exit() +X http://code.google.com/p/processing/issues/detail?id=698 opengl applets X implement new applet-opengl.html based on the latest jogl @@ -327,6 +329,16 @@ o textMode(SCREEN) is out of its league? o textMode(SHAPE) and hint(SMOOTHING) calls are really awkward o maybe need to add properties to the size() command? o or use a getXxxx() method? +o in PShape, getChild(name) refers to a +o however in an XML file, that's , meaning the name of the tag +o change it to getShape(name)? also for fonts getShape(char c) +o decision: use getShape() (maybe add getShapeCount and getShape(int)) +o and remove getChild() from PShape +o oops: getParent() is in there, as is getChildren() and others... +o svg examples should use getShape(name) not getChild(name) +X better to not break the naming, since getParent() needs to stay +X nobody felt strongly enough about getShape() +X so better to not change (and start breaking things) xml changes o see if write() is necessary inside PNodeXML @@ -424,7 +436,6 @@ _ figure out why font naming not working correctly _ add blendMode() to reference, remove blend() _ need documentation for quadraticVertex() _ docs for rect(x, y, w, h, r) and rect(x, y, w, h, tl, tr, br, bl) -_ svg examples should use getShape(name) not getChild(name) _ screen.width/height shouldn't be anywhere _ add docs for screenWidth and screenHeight _ remove delay() documentation @@ -433,7 +444,7 @@ _ remove delay() documentation _ texts using textMode(SCREEN) not displayed in Processing 1.5.1 _ http://code.google.com/p/processing/issues/detail?id=741 _ thread() causes weird flickering -_ http://code.google.com/p/processing/issues/detail?id=742svn st +_ http://code.google.com/p/processing/issues/detail?id=742 _ toArray(), toArray(float[]), toVectorArray(), toVectorArray(PVector[]) _ toColorArray(), toColorArray(float[])... @@ -541,12 +552,6 @@ _ http://code.google.com/p/processing/issues/detail?id=246 _ path for selectXxxxx() functions _ http://code.google.com/p/processing/issues/detail?id=233 _ provide a way to clear the PGraphics with plain alpha -_ in PShape, getChild(name) refers to a -_ however in an XML file, that's , meaning the name of the tag -_ change it to getShape(name)? also for fonts getShape(char c) -_ decision: use getShape() (maybe add getShapeCount and getShape(int)) -_ and remove getChild() from PShape -_ oops: getParent() is in there, as is getChildren() and others... _ opengl applet problems _ http://code.google.com/p/processing/issues/detail?id=196