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

Kevin Rushforth kcr at openjdk.org
Thu Dec 22 00:18:48 UTC 2022


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.

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

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

Changes: https://git.openjdk.org/jfx/pull/981/files
 Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=981&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8296654
  Stats: 9 lines in 1 file changed: 6 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jfx/pull/981.diff
  Fetch: git fetch https://git.openjdk.org/jfx pull/981/head:pull/981

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


More information about the openjfx-dev mailing list