add a stop() to destroy() to prevent thread issues

This commit is contained in:
benfry
2004-07-15 15:01:33 +00:00
parent a984ec5d3d
commit 81bc77a7fe
2 changed files with 25 additions and 12 deletions

View File

@@ -241,9 +241,23 @@ public class PApplet extends Applet
}
// public void destroy() is another one that gets called as the
// applet viewer is shutting down the applet. stop() is called
// first, and then destroy() to really get rid of things.
/**
* This also calls stop(), in case there was an inadvertent
* override of the stop() function by a user.
*
* destroy() supposedly gets called as the applet viewer
* is shutting down the applet. stop() is called
* first, and then destroy() to really get rid of things.
* no guarantees on when they're run (on browser quit, or
* when moving between pages), though.
*/
public void destroy() {
if (thread != null) {
// call stop since this prolly means someone
// over-rode the stop() function
stop();
}
}
public Dimension getPreferredSize() {