From 61ca0a975341f40fbbb46379b10fbf77f0bf3d95 Mon Sep 17 00:00:00 2001 From: Adam Domurad Date: Thu, 25 Apr 2013 10:53:44 -0400 Subject: Fix a dead-lock bug that can cause Firefox to hang. --- .../java/sun/applet/PluginAppletViewer.java | 30 +++------------------- 1 file changed, 4 insertions(+), 26 deletions(-) (limited to 'plugin/icedteanp/java/sun/applet') diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java index 8423c5d..d07d0c2 100644 --- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java +++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java @@ -652,8 +652,7 @@ public class PluginAppletViewer extends XEmbeddedFrame panelLock.lock(); try { - while (panel.getApplet() == null && - panel.isAlive() && + while (!panel.isInitialized() && maxTimeToSleep > 0) { PluginDebug.debug("Waiting for applet panel ", panel, " to initialize..."); maxTimeToSleep -= waitTillTimeout(panelLock, panelLive, maxTimeToSleep); @@ -731,37 +730,16 @@ public class PluginAppletViewer extends XEmbeddedFrame // object should belong to? Object o; - // First, wait for panel to instantiate - // Next, wait for panel to come alive - long maxTimeToSleep = APPLET_TIMEOUT; - panelLock.lock(); - try { - while (panel == null || !panel.isAlive()) { - maxTimeToSleep -= waitTillTimeout(panelLock, panelLive, - maxTimeToSleep); - - /* we already waited till timeout, give up here directly, - * instead of waiting 180s again in below waitForAppletInit() - */ - if(maxTimeToSleep < 0) { - streamhandler.write("instance " + identifier + " reference " + -1 + " fatalError: " + "Initialization timed out"); - return; - } - } - } - finally { - panelLock.unlock(); - } - // Wait for the panel to initialize // (happens in a separate thread) waitForAppletInit(panel); - PluginDebug.debug(panel, " -- ", panel.getApplet(), " -- ", panel.isAlive()); + PluginDebug.debug(panel, " -- ", panel.getApplet(), " -- initialized: ", panel.isInitialized()); // Still null? if (panel.getApplet() == null) { - streamhandler.write("instance " + identifier + " reference " + -1 + " fatalError: " + "Initialization timed out"); + streamhandler.write("instance " + identifier + " reference " + -1 + " fatalError: " + "Initialization failed"); + streamhandler.write("context 0 reference " + reference + " Error"); return; } -- cgit v1.2.3