On Fri, 22 Dec 2023 11:27:00 GMT, Johannes Bechberger <jbechber...@openjdk.org> 
wrote:

> A dead-lock is caused by the interaction of MacOS, the AWTEventQueue and 
> JavaFX when the users pressed the Caps Lock key while the AWTEventQueue is 
> processing another event (more on this in the issue). The bug depends on the 
> specific timing of the event sending and can apparently be prevented by 
> finishing all incoming OS events directly while the LWCToolkit.invokeAndWait 
> method is executed.
> 
> This fix is tested and fixes the issue.
> 
> I attached a small
> [reproducer](https://github.com/openjdk/jdk/files/13751865/Archive.zip), just 
> run it with `mvn install package javafx:run`.

I note that your proposed solution was originally pointed out as a workaround 
by Arunprasad Rajkumar in [this JBS 
comment](https://bugs.openjdk.org/browse/JDK-8221261?focusedId=14255770&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14255770).

One possible problem with the above workaround is mentioned in [this 
comment](https://github.com/openjdk/jdk/blob/bef94378ddf33ab29a36e1ceee48890a5b5c7a9d/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java#L930)
 describing the `processEvents` parameter (the one you are changing from 
`false` to `true`) in the `doAWTRunLoop` method:

"Additional attention is needed when using this feature as we short-circuit 
normal event processing which could break Appkit"

Anton Tarasov proposed a modified solution, in [this JBS 
comment](https://bugs.openjdk.org/browse/JDK-8221261?focusedId=14263545&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14263545),
 that spins up a nested event loop that processes events only for the 
`firstRectForCharacterRange` and `characterIndexForPoint` methods in 
`CInputMethod`. Presuming that this is the right place to fix it, this seems a 
safer approach, although still needs to be evaluated.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17184#issuecomment-1867861682

Reply via email to