--- old/src/share/classes/sun/awt/SunToolkit.java 2012-09-07 16:30:38.553272100 +0400 +++ new/src/share/classes/sun/awt/SunToolkit.java 2012-09-07 16:30:37.999240400 +0400 @@ -556,15 +556,19 @@ // Don't call flushPendingEvents() recursively if (!isFlushingPendingEvents) { isFlushingPendingEvents = true; - AppContext appContext = AppContext.getAppContext(); - PostEventQueue postEventQueue = - (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY); - if (postEventQueue != null) { - postEventQueue.flush(); + try { + AppContext appContext = AppContext.getAppContext(); + PostEventQueue postEventQueue = + (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY); + if (postEventQueue != null) { + postEventQueue.flush(); + } + } + finally { + isFlushingPendingEvents = false; } } } finally { - isFlushingPendingEvents = false; flushLock.unlock(); } }