changeset 469:d6e1139ec7d9

Fix possible endless loop while waiting for the applet object instance to get create get created
author Thomas Meyer <thomas@m3y3r.de>
date Thu, 19 Jul 2012 18:44:51 +0200
parents 01544fb82384
children be423d1f265d
files ChangeLog plugin/icedteanp/java/sun/applet/PluginAppletViewer.java
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jul 11 16:18:58 2012 +0200
+++ b/ChangeLog	Thu Jul 19 18:44:51 2012 +0200
@@ -1,3 +1,9 @@
+2012-07-18  Thomas Meyer  <thomas@m3y3r.de>
+
+	* plugin/icedteanp/java/sun/applet/PluginAppletViewer.java (handleMessage):
+	Fix possible endless loop while waiting for the applet object instance to 
+	get created.
+
 2012-07-11  Jiri Vanek  <jvanek@redhat.com>
 
 	try to close browser before kill it
--- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java	Wed Jul 11 16:18:58 2012 +0200
+++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java	Thu Jul 19 18:44:51 2012 +0200
@@ -745,9 +745,18 @@
             long maxTimeToSleep = APPLET_TIMEOUT;
             panelLock.lock();
             try {
-                while (panel == null || !panel.isAlive())
+                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();