RFR: 8296654: [macos] Crash when launching JavaFX app with JDK that targets SDK 13

Ajit Ghaisas aghaisas at openjdk.org
Thu Dec 22 05:18:52 UTC 2022


On Thu, 22 Dec 2022 00:13:03 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

> Apple has changed the behavior for applications that are built using the macOS SDK 13 (which is what XCode 14 uses), such that passing in a null tracking rect to `NSView::removeTrackingRect` will cause now cause a crash. This has exposed a latent bug in the JavaFX macOS glass code that removes the previous tracking rect even if it is null in `setFrame`, `setFrameSize`,  and `updateTrackingAreas`.
> 
> The fix is to check that the current tracking rect is non null before calling `removeTrackingRect` as suggested in both this bug report and duplicate bug [JDK-8297131](https://bugs.openjdk.org/browse/JDK-8297131). The latter bug report describes an easy way to reproduce this without building your own JDK, by making a copy of the JDK and modifying the meta-data that indicates the target version of the macOS SDK. I did that, and can reproduce this crash with any JavaFX program without this fix, and verified that it works correctly with this fix.
> 
> NOTE: it is the version of the SDK (Xcode) that the JDK is targeted to that matters. It is irrelevant what version of the SDK (i.e., what Xcode) is used to build JavaFX. This make this a more serious bug than it otherwise would be.

I have a x86_64 Mac system. I was unable to simulate the crash using the `smart way` described in [JDK-8297131](https://bugs.openjdk.org/browse/JDK-8297131). I wonder whether the bug is aarch64 only?

I see that all the occurrences of `self->trackingRect` in the codebase have null check now.
Approving as it looks the obvious fix.

-------------

Marked as reviewed by aghaisas (Reviewer).

PR: https://git.openjdk.org/jfx/pull/981


More information about the openjfx-dev mailing list