RFR: 8190329: [macos] Swing InterOp Platform.exit() crash [v2]
Kevin Rushforth
kcr at openjdk.org
Thu Aug 29 23:03:18 UTC 2024
On Thu, 29 Aug 2024 21:34:18 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> src/java.desktop/macosx/native/libawt_lwawt/awt/ApplicationDelegate.m line 128:
>>
>>> 126: [ThreadUtilities setApplicationOwner:NO];
>>> 127: return nil;
>>> 128: }
>>
>> If you flip the default, then you need to set it to YES here:
>>
>>
>> [ThreadUtilities setApplicationOwner:YES];
>>
>>
>> (this might be best anyway, since then you will always set the flag)
>
> Do we want to use cached version for this case?
> `[NSApp isMemberOfClass:[NSApplication class]] && overrideDelegate`
Hmm. Probably not. We don't really expect that anyone will ever set the (undocumented) env variable that will set the `overrideDelegate` flag, but it might be safest to only use the cached env if `[NSApp isKindOfClass:[NSApplicationAWT class]]`.
If so, one way to do this would be to change line 129 to:
[ThreadUtilities setApplicationOwner:[NSApp isKindOfClass:[NSApplicationAWT class]]];
Or keep track of a second flag, something like this:
BOOL isApplicationOwner = NO;
if (NSApp != nil) {
if ([NSApp isMemberOfClass:[NSApplication class]] && overrideDelegate) shouldInstall = YES;
if ([NSApp isKindOfClass:[NSApplicationAWT class]]) {
shouldInstall = YES;
isApplicationOwner = YES;
}
}
[ThreadUtilities setApplicationOwner:isApplicationOwner];
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20688#discussion_r1737403557
More information about the client-libs-dev
mailing list