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

Print this page

        

*** 1045,1054 **** --- 1045,1058 ---- } } final boolean detachDispatchThread(EventDispatchThread edt, boolean forceDetach) { /* + * Minimize discard possibility for non-posted events + */ + SunToolkit.flushPendingEvents(); + /* * This synchronized block is to secure that the event dispatch * thread won't die in the middle of posting a new event to the * associated event queue. It is important because we notify * that the event dispatch thread is busy after posting a new event * to its queue, so the EventQueue.dispatchThread reference must
*** 1062,1072 **** * sure if it's a possible scenario, though. * * Fix for 4648733. Check both the associated java event * queue and the PostEventQueue. */ ! if (!forceDetach && (peekEvent() != null) || !SunToolkit.isPostEventQueueEmpty()) { return false; } dispatchThread = null; } AWTAutoShutdown.getInstance().notifyThreadFree(edt); --- 1066,1076 ---- * sure if it's a possible scenario, though. * * Fix for 4648733. Check both the associated java event * queue and the PostEventQueue. */ ! if (!forceDetach && (peekEvent() != null)) { return false; } dispatchThread = null; } AWTAutoShutdown.getInstance().notifyThreadFree(edt);