On Sat, 24 Aug 2024 12:36:55 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
> > > Another possible fix would be to have AWT not use the cached JNI Env when > > > it is not the NSApplication owner. I don't know how viable this fix would > > > be, or whether it is the right fix, but it would prevent the crash in all > > > possible places. > > > > > > That sounds like lots of places would need to be updated to do this. > > No, only in one place. The idea I had -- and did a quick prototype of -- was > to change the implementation of `[ThreadUtilities getJNIEnv]` to check a flag > to see whether or not AWT was the owner of the NSApplication and, if not, > effectively do the same thing as `getJNIEnvUncached`. What that would then do > would be to re-attach the AppKit thread to the JVM if FX had detached it. > This will avoid the crash in all places without having to change the callers > of `getJNIEnv` I've looked and I think that would work. Minimal overhead in the 99.99% "non-embedded" case. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20688#discussion_r1730137603