On Fri, 10 Nov 2023 21:26:21 GMT, Sergey Bylokhov <[email protected]> wrote:
>> It can be null if the NSApplication was created by code outside of AWT. >> Specifically, in the case of an FX or SWT toolkit, but in theory a native >> application using JAWT could do this. >> >> In practice, since we haven't even seen a crash as a result of this, I doubt >> that this code is ever called if AWT isn't running the event loop and hasn't >> installed their delegate. > > To access any native code in AWT the app should initially init the LWCToolkit > which sets that application delegate if it is not set already. Do we know how > the FX can bypass that initialization? In the case when AWT is embedded AWT does NOT start an NSApplication and does not own it. AWT overwriting FX's delegate, or any one else's is just plain wrong. We can turn around what you said "To access any native code in JavafX, the app should initialise GlassToolkit which sets its delegate, if not already set". But you can't have both of these. Meaning AWT isn't special here. It has to play by the same rules. The toolkit that starts the NSApplication is the one that should be setting the delegate. If you are embedded in someone else's application, it seems most logical that you defer to their application and if this means some things aren't possible, so be it. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16569#discussion_r1389984998
