src/share/classes/java/awt/Window.java

Print this page

        

@@ -1198,10 +1198,11 @@
             } finally {
                 disposing = false;
             }
         }
     }
+        boolean fireWindowClosedEvent = isDisplayable();
         DisposeAction action = new DisposeAction();
         if (EventQueue.isDispatchThread()) {
             action.run();
         }
         else {

@@ -1218,12 +1219,14 @@
             }
         }
         // Execute outside the Runnable because postWindowEvent is
         // synchronized on (this). We don't need to synchronize the call
         // on the EventQueue anyways.
+        if (fireWindowClosedEvent) {
         postWindowEvent(WindowEvent.WINDOW_CLOSED);
     }
+    }
 
     /*
      * Should only be called while holding the tree lock.
      * It's overridden here because parent == owner in Window,
      * and we shouldn't adjust counter on owner