On Tue, 11 Jan 2022 22:18:53 GMT, Martin Fox <[email protected]> wrote:
> The OS crashes if the contentView of a window is set to nil while handling
> processKeyEquivalent. With this PR we just set the contentView to a basic
> do-nothing NSView for the interim.
This PR fixes the JDK-8242544 issue as intended. I've added a couple of minor
comments.
Regarding #704, which also fixed the related issue JDK-8205915 but was
targeting JDK-8242544, maybe it should be just updated to target the former?
modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m line 847:
> 845: {
> 846: // If the contentView is set to nil within
> performKeyEquivalent: the OS will crash.
> 847: NSView* dummy = [[NSView alloc] initWithFrame: NSMakeRect(0,
> 0, 10, 10)];
The view could be also created with a (0, 0, 0, 0) rect, couldn't it?
modules/javafx.graphics/src/main/native-glass/mac/GlassWindow.m line 848:
> 846: // If the contentView is set to nil within
> performKeyEquivalent: the OS will crash.
> 847: NSView* dummy = [[NSView alloc] initWithFrame: NSMakeRect(0,
> 0, 10, 10)];
> 848: [window->nsWindow
> performSelectorOnMainThread:@selector(setContentView:) withObject:dummy
> waitUntilDone:YES];
I'm not sure is needed or worth it, but maybe the `dummy` view should be
released?
-------------
PR: https://git.openjdk.java.net/jfx/pull/714