On Wed, 29 Nov 2023 06:55:17 GMT, Sergey Bylokhov <[email protected]> wrote:
>>>The reason has to why we don't observe NPE or crash when sharedDelegate is >>>null is >> >> But why it is null? The OSXAPP_SetApplicationDelegate is called when the >> LWCToolkit is initialized in non-headless >> [mode](https://github.com/openjdk/jdk/blob/9a6ca233c7e91ffa2ce9451568b3be88ccd04504/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m#L355) >> and that code does not depend on "NSApplicationAWT". Does it mean that the >> toolkit is not initiated? Then how we can call peer-menu-related code? if >> that code path is not executed probably we should change that? > > I found a reason in one comment above. I guess the code [ApplicationDelegate.m](https://github.com/openjdk/jdk/blob/5493f5f92d569d8e94d1f271480f11c48257e896/src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m#L118C4-L128C33) should be changed. Right now it has some checks to prevent "double initialization", but it should take care about the case if the delegate is set already by some external lib. Leaving that as null and skip it in the code means that part of the API will stop working, mostly java.awt.desktop package? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16569#discussion_r1408843056
