aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeepak Bhole <[email protected]>2011-05-27 17:03:25 -0400
committerDeepak Bhole <[email protected]>2011-05-27 17:03:25 -0400
commit2a1e9cdc0b595cc4e014f089e5d20bb51a07906f (patch)
tree088476949ffa1c6d780772301eeb6585561ed8a1
parentc571fe4ca9753affefee9be384868630b24a479f (diff)
Backed out 0256de6a4bf6 as it is prone to race conditions.
-rw-r--r--ChangeLog4
-rw-r--r--plugin/icedteanp/java/sun/applet/PluginAppletViewer.java27
2 files changed, 13 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 42e22fc..ce3c740 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-05-27 Deepak Bhole <[email protected]>
+
+ * Backed out 0256de6a4bf6
+
2011-05-27 Omair Majid <[email protected]>
* NEWS: Update.
diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
index cc1f716..d974ca9 100644
--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
@@ -1621,26 +1621,15 @@ public class PluginAppletViewer extends XEmbeddedFrame
if (cl instanceof JNLPClassLoader.CodeBaseClassLoader)
cl = ((JNLPClassLoader.CodeBaseClassLoader) cl).getParentJNLPClassLoader();
+ ThreadGroup tg = ((JNLPClassLoader) cl).getApplication().getThreadGroup();
+
appletShutdown(p);
appletPanels.removeElement(p);
-
- /* 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
- */
+ dispose();
- try {
- SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- dispose();
- }
- });
- } catch (Exception e) { // ignore, we are just disposing it
- }
+ if (tg.activeCount() > 0)
+ tg.stop();
- // 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();
}
@@ -1651,10 +1640,12 @@ public class PluginAppletViewer extends XEmbeddedFrame
}
/**
- * This function should be called to halt the VM when all applets are destroyed.
+ * Exit the program.
+ * Exit from the program (if not stand alone) - do no clean-up
*/
private void appletSystemExit() {
- System.exit(0);
+ // Do nothing. Exit is handled by another
+ // block of code, called when _all_ applets are gone
}
/**