I am hosting processing.org sketches (or rather, Java Applets that extend PApplet) within a larger application. In this case it is an Eclipse RCP application, but the principles would be the same in most application frameworks.
I have an Eclipse RCP view which hosts a processing PApplet via an Albireo SwingControl wrapper (a glorified version of the SWT_AWT bridge).
When my view is opened, I create a new PApplet, add it to the Albireo SwingControl frame, and call init() followed by start() on the Applet.
When my view is closed, I need to clean up all the resources I have allocated. In this case, since our application runs for a long period of time and can consume a lot of resources, I want to shut down Processing and aid the garbage collector in cleaning up as much as possible.
To do this, I call stop() followed by destroy(). Since I am the Applet host, and destroy() is the complement of init(), I believe this is the correct thing to do.
Inside PApplet, stop() simply pauses the animation thread. There is a comment saying that the code has moved to dispose(), but the documentation for dispose() states users must not call this. destroy() ultimately calls System.exit() which terminates everything in the running JVM. To me this is a very antisocial behaviour, given it is the complement of init(), but I accept I am very likely missing something here.
The ticket for destroy() calling System.exit() has just been marked as invalid, stating that only browsers should call destroy().
What am I doing wrong here? How should I be cleaning up processing.org sketches hosted in this way?
I've just seen the new Processing Eclipse plugin - very cool, and something I'd been wanting for a long time, and something that I thought would be cool to have in other Eclipse RCP based applications. However, I thought it was impossible to achieve due to licencing conflicts (though when I started thinking about it I wondered if there were other conflicts already too).
The PDE and the processing script processor are licenced under the GPL.
The Processing library is under the LGPl.
The new Eclipse Plugin, and the Eclipse compiler are EPL.
However, the EPL and the GPL are incompatible licences when creating derivative works - which I think this falls into (And I think the PDE probably does re: the EPL).
From the EPL FAQ:
Are the Eclipse Public License (EPL) and the General Public License (GPL) compatible? The EPL and the GPL are not compatible in any combination where the result would be considered either: (a) a �derivative work� (which Eclipse interprets consistent with the definition of that term in the U.S. Copyright Act ) or (b) a work �based on� the GPL code, as that phrase is used in the GPLv2, GPLv3 or the GPL FAQ as applicable. Further, you may not combine EPL and GPL code in any scenario where source code under those licenses are both the same source code module.
Based upon the position of the Free Software Foundation, you may not combine EPL and GPL code in any scenario where linking exists between code made available under those licenses. The above applies to both GPL version 2 and GPL version 3.
Could someone from the processing team clarify the situation regarding these licences? According to the FSF definition, doesn't processing violate the GPL anyway?