2002/09/02 18:38:20
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:50:25 +0000 (06:50 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:50:25 +0000 (06:50 +0000)
darcs-hash:20040130065025-2ba56-eefad2326710ff34b824a96bceef493936dfde7d.gz

src/org/xwt/Main.java
src/org/xwt/Surface.java

index a94ca81..294fd9e 100644 (file)
@@ -35,6 +35,9 @@ public class Main extends Applet {
 
     public static Applet applet = null;
 
+    /** don't check if all surfaces are gone (and quit) until this is true */
+    public static boolean doneInitializing = false;
+
     /** applet entry point */
     public void init() {
         if ("true".equals(getParameter("showRenders"))) showRenders = true;
@@ -115,6 +118,11 @@ public class Main extends Applet {
             ThreadMessage.newthread(new JSObject.JSFunction() {
                     public Object call(Context cx, Scriptable thisObj, Scriptable ctorObj, Object[] arg) throws JavaScriptException {
                         new Box(initialTemplate_f, null);
+                       doneInitializing = true;
+                       if (Surface.allSurfaces.size() == 0) {
+                           Log.log(this, "exiting because all surfaces are gone");
+                           Platform.exit();
+                       }
                         return null;
                     }
                 });
index 1266466..167a5f4 100644 (file)
@@ -381,7 +381,7 @@ public abstract class Surface {
         _dispose();
 
         // quit when all windows are closed
-        if (allSurfaces.size() == 0 && quitIfAllSurfacesGone) {
+        if (allSurfaces.size() == 0 && quitIfAllSurfacesGone && Main.doneInitializing) {
             if (Log.on) {
                 if (refreshableSurfaceWasCreated) Log.log(this, "exiting because last remaining surface was disposed");
                 else Log.log(this, "exiting because no surface was ever created");