--- old/src/share/classes/java/awt/EventQueue.java 2012-09-08 02:30:08.055610000 +0400 +++ new/src/share/classes/java/awt/EventQueue.java 2012-09-08 02:30:07.181560000 +0400 @@ -1046,6 +1046,10 @@ } 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 @@ -1064,7 +1068,7 @@ * Fix for 4648733. Check both the associated java event * queue and the PostEventQueue. */ - if (!forceDetach && (peekEvent() != null) || !SunToolkit.isPostEventQueueEmpty()) { + if (!forceDetach && (peekEvent() != null)) { return false; } dispatchThread = null;