On Fri, 2 Dec 2022 05:40:06 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
>> There was a comment in the original code before the realSync() call that was >> removed, which perhaps should have been left as is. >> // cannot substitute with robot.waitForIdle() presumably because of >> flushPendingEvents() there >> My understanding of above is that for simulating the test scenario - which >> is - Events (on line 75,76,77) are triggered and while these are potentially >> not yet complete(as they are wrapped in an invokeLater), the edt is >> interrupted. >> >> When run on jdk7u6 - the UI hangs and SOP of line 59 is not invoked. >> When run on jdk7u361 b01 the SOP on line 59 is printed and also the test >> passed. >> >> waitForIdle here will trigger the flushPendingEvents internally before the >> edt interrupt call -and that would eliminate any possibility of simulating >> the above scenario. > > Then please double-check how robot.waitForIdle() and realSync() affect the > test, since both call the flushPendingEvents(), why there is a difference? > * robot.waitForIdle()->SunToolkit.flushPendingEvents(); > * realSync()->waitForIdle()->flushPendingEvents That's right. If the test hangs when `Robot.waitForIdle` is called, it looks like another problem in the JDK. `Robot.waitForIdle` calls `SunToolkit.flushPendingEvents` followed by `SunToolkit.realSync`. `SunToolkit.realSync`, in its turn, calls `SunToolKit.waitForIdle` in a loop which calls `SunToolkit.flushPendingEvents`. It looks like a problem to me. ------------- PR: https://git.openjdk.org/jdk/pull/10784