RFR: 8190329: [macos] Swing InterOp Platform.exit() crash [v2]
Sergey Bylokhov
serb at openjdk.org
Wed Aug 28 18:24:20 UTC 2024
On Wed, 28 Aug 2024 02:19:08 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> The testcase calls Platform.exit before the dialog is made visible but
>> on macOS, JavaFX takes over the AppKit thread and uses that as the FX application thread. As part of the FX platform shutdown process, it detaches that thread from the JVM. This means that the AppKit thread is no longer available to Java processes
>> so AWT crashes when it ties to access appkit thread.
>> Fix is made to check if the thread has been detached for move-resize notification event before proceeding..
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>
> Reattach thread if AWT is the owner of NSApplication
src/java.desktop/macosx/native/libosxapp/ThreadUtilities.m line 67:
> 65: }
> 66:
> 67: + (JNIEnv*)getJNIEnv {
The cached version of 'getJNIEnv' was added for performance reasons to skip `attachCurrentThread` if we know for sure that initialization has already completed. But is it still necessary to track all this flags now, maybe the `attachCurrentThread` now smart enough to check that the current thread was already attached, or it is just fast enough?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20688#discussion_r1735116029
More information about the client-libs-dev
mailing list