--- old/src/share/classes/java/awt/EventQueue.java 2012-08-28 18:06:54.572859600 +0400 +++ new/src/share/classes/java/awt/EventQueue.java 2012-08-28 18:06:53.740812000 +0400 @@ -1031,6 +1031,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 @@ -1049,7 +1053,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;