Hi, Oleg,

shouldn't flushLock.unlock() be protected with

    if (--flushNestingLevel == 0)

check?

Thanks,

Artem

On 9/7/2012 5:57 AM, Oleg Pekhovskiy wrote:
Hi!

Please review the fix for CR:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7188708

Webrev:
http://cr.openjdk.java.net/~bagiras/7u10/7188708.1/

The reason is that isFlushingPendingEvents in
SunToolkit.flushPendingEvents() is reset
after the first recursive call of flushPendingEvents(). Thus, if there
are several pending events in PostEventQueue,
recursion would be rejected only for the first event, allowing nested
call of PostEventQueue.flush() after.

To resolve the problem I added the counter "flushNestingLevel" instead
of the flag "isFlushingPendingEvents".
It's increased each time entering SunToolkit.flushPendingEvents() and
decreased on exit.
So, PostEventQueue.flush() method is called only when we enter
SunToolkit.flushPendingEvents() for the first time
within one thread.

That fix was prepared ONLY for 7u10.
For JDK 8 the fix for "CR7186109 - Simplify lock machinery for
PostEventQueue & EventQueue" should cover this case.

Thanks,
Oleg

Reply via email to