<AWT Dev> [10] Review Request: 8186263 The SunDropTargetEvent sometimes is not dispatched
Sergey Bylokhov
sergey.bylokhov at oracle.com
Thu Aug 17 18:56:26 UTC 2017
Hello,
Please review one more fix for DnD in jdk10.
Bug: https://bugs.openjdk.java.net/browse/JDK-8186263
Webrev can be found at: http://cr.openjdk.java.net/~serb/8186263/webrev.00
The SunDropTargetEventEach is a special kind of MouseEvent and each SunDropTargetEvent should be dispatched, because this event stop the ToolkitThreadBlockedHandler.
- The nested event loop is started before SunDropTargetEvent is created. See SunDropTargetContextPeer.postDropTargetEvent()
- The SunDropTargetEvent is posted with assumption that when it will be dispatched it will stop the nested event loop. See SunDropTargetContextPeer.unregisterEvent().
SunDropTargetEvent is a subclass of MouseEvent. The dispatch of MouseEvent may be skipped if this event will be coalesced or if the target component will be disposed.
The coalescing of the SunDropTargetEvent was fixed in JDK-7177144, but it is still possible to lose the SunDropTargetEvent if the target component wlll be disposed after the event was posted, but before dispatch. This can cause a hang in DnD machinery.
After the fix we will stop the nested loop even if the SunDropTargetEventEach is removed from the EventQueue.
The test was modified to reproduce the bug more often on macOS and Linux.
Note that the test still fail time to time on macOS because of [1].
[1] https://bugs.openjdk.java.net/browse/JDK-8186002
More information about the awt-dev
mailing list