/hg/icedtea-web: Prevent applet from shutting down down if anoth...
dbhole at icedtea.classpath.org
dbhole at icedtea.classpath.org
Mon May 2 11:32:32 PDT 2011
changeset 6fe7281c17b7 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=6fe7281c17b7
author: Deepak Bhole <dbhole at redhat.com>
date: Mon May 02 14:33:32 2011 -0400
Prevent applet from shutting down down if another tab with the same
page is opened and closed.
diffstat:
ChangeLog | 8 ++++
plugin/icedteanp/java/sun/applet/PluginAppletViewer.java | 27 ++++++++++-----
2 files changed, 26 insertions(+), 9 deletions(-)
diffs (65 lines):
diff -r d57169ddb76a -r 6fe7281c17b7 ChangeLog
--- a/ChangeLog Fri Apr 29 16:58:05 2011 -0400
+++ b/ChangeLog Mon May 02 14:33:32 2011 -0400
@@ -1,3 +1,11 @@
+2011-05-02 Deepak Bhole <dbhole at redhat.com>
+
+ * plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
+ (appletClose): Do not try to stop threads, now that the loader is shared
+ and the thread group for applets on a page is identical. Call dispose from
+ invokeAndWait.
+ (appletSystemExit): Exit the VM when called.
+
2011-04-28 Denis Lila <dlila at redhat.com>
* netx/net/sourceforge/jnlp/NetxPanel.java:
diff -r d57169ddb76a -r 6fe7281c17b7 plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Fri Apr 29 16:58:05 2011 -0400
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java Mon May 02 14:33:32 2011 -0400
@@ -1621,15 +1621,26 @@
if (cl instanceof JNLPClassLoader.CodeBaseClassLoader)
cl = ((JNLPClassLoader.CodeBaseClassLoader) cl).getParentJNLPClassLoader();
- ThreadGroup tg = ((JNLPClassLoader) cl).getApplication().getThreadGroup();
-
appletShutdown(p);
appletPanels.removeElement(p);
- dispose();
+
+ /* TODO: Applets don't always shut down nicely. We
+ * need to find a proper way to forcibly closing all threads
+ * an applet starts during its lifetime
+ */
- if (tg.activeCount() > 0)
- tg.stop();
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ dispose();
+ }
+ });
+ } catch (Exception e) { // ignore, we are just disposing it
+ }
+ // If there are no more applets running, exit the VM
+ // TODO: There is a possible race condition here as count
+ // can be 0 when an applet is in the initialization phase
if (countApplets() == 0) {
appletSystemExit();
}
@@ -1640,12 +1651,10 @@
}
/**
- * Exit the program.
- * Exit from the program (if not stand alone) - do no clean-up
+ * This function should be called to halt the VM when all applets are destroyed.
*/
private void appletSystemExit() {
- // Do nothing. Exit is handled by another
- // block of code, called when _all_ applets are gone
+ System.exit(0);
}
/**
More information about the distro-pkg-dev
mailing list