src/java.desktop/share/classes/java/awt/EventQueue.java

Print this page

        

@@ -897,15 +897,17 @@
                         getEventLog().fine("Interrupted push", ie);
                     }
                 }
             }
 
+            if (topQueue.dispatchThread != null) {
             // Wake up EDT waiting in getNextEvent(), so it can
             // pick up a new EventQueue. Post the waking event before
             // topQueue.nextQueue is assigned, otherwise the event would
             // go newEventQueue
             topQueue.postEventPrivate(new InvocationEvent(topQueue, dummyRunnable));
+            }
 
             newEventQueue.previousQueue = topQueue;
             topQueue.nextQueue = newEventQueue;
 
             if (appContext.get(AppContext.EVENT_QUEUE_KEY) == topQueue) {