src/share/classes/sun/awt/SunToolkit.java
Print this page
*** 542,572 ****
}, PeerEvent.ULTIMATE_PRIORITY_EVENT);
postEvent(targetToAppContext(e.getSource()), pe);
}
protected static final Lock flushLock = new ReentrantLock();
! private static boolean isFlushingPendingEvents = false;
/*
* Flush any pending events which haven't been posted to the AWT
* EventQueue yet.
*/
public static void flushPendingEvents() {
flushLock.lock();
try {
// 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();
}
}
} finally {
! isFlushingPendingEvents = false;
flushLock.unlock();
}
}
public static boolean isPostEventQueueEmpty() {
--- 542,572 ----
}, PeerEvent.ULTIMATE_PRIORITY_EVENT);
postEvent(targetToAppContext(e.getSource()), pe);
}
protected static final Lock flushLock = new ReentrantLock();
! private static int flushNestingLevel = 0;
/*
* Flush any pending events which haven't been posted to the AWT
* EventQueue yet.
*/
public static void flushPendingEvents() {
flushLock.lock();
try {
// Don't call flushPendingEvents() recursively
! ++flushNestingLevel;
! if (flushNestingLevel == 1) {
AppContext appContext = AppContext.getAppContext();
PostEventQueue postEventQueue =
(PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
if (postEventQueue != null) {
postEventQueue.flush();
}
}
} finally {
! --flushNestingLevel;
flushLock.unlock();
}
}
public static boolean isPostEventQueueEmpty() {