src/share/classes/java/awt/EventQueue.java
Print this page
*** 1030,1039 ****
--- 1030,1043 ----
}
}
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
*** 1047,1057 ****
* 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);
--- 1051,1061 ----
* 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);