On Wed, 29 Nov 2023 06:51:27 GMT, Sergey Bylokhov <[email protected]> wrote:
>> So in either case -- with or without the delegate being overridden -- the >> defaultMenuBar is returning `nil`. This makes sense, since in the case of a >> JavaFX app, JavaFX has already initialized the `NSApplication` and set the >> system menu bar. >> >> I do recommend leaving the `sharedDelegate` null checks that you added as >> part of this PR, since that way we short-circuit any other logic (e.g., in >> this specific case you avoid setting `isDisabled = NO` which seems more >> accurate), and you aren't relying on Objective C to treat this case as a >> no-op. >> >> You might even consider making the `sharedDelegate` null check (and bailing >> out) earlier, but maybe there is a good reason to leave the check where it >> is. > >>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. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16569#discussion_r1408826874
