JDK-8335630 : Crash if Platform::exit called with fullScreen Stage on macOS 14
  • Type: Bug
  • Component: javafx
  • Sub-Component: window-toolkit
  • Affected Version: jfx23
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2024-07-03
  • Updated: 2024-07-22
  • Resolved: 2024-07-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx23Fixed
Related Reports
Relates :  
Relates :  
Description
To reproduce this, run the following on a macOS 14.5 Sonoma system: 

1. Run the HelloFullscreen program (in apps/toys/Hello)
2. Press the "Exit" button 
BUG: This will print an assertion failure message and then crash:

Java has been detached already, but someone is still trying to use it at -[GlassWindow(Overrides) windowDidResignKey:]:/Users/kcr/dev/javafx/jfx-clean/jfx/rt/modules/javafx.graphics/src/main/native-glass/mac/GlassWindow+Overrides.m:96

Note that on macOS 13.x these same steps will case get an exception as described in JDK-8299738, but no crash.

Following is the complete stack trace for the assertion failure:

Java has been detached already, but someone is still trying to use it at -[GlassWindow(Overrides) windowDidResignKey:]:/Users/kcr/dev/javafx/jfx-clean/jfx/rt/modules/javafx.graphics/src/main/native-glass/mac/GlassWindow+Overrides.m:96
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000128ce8e60, pid=61623, tid=259
#
# JRE version: Java(TM) SE Runtime Environment (21.0.2+13) (build 21.0.2+13-LTS-58)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (21.0.2+13-LTS-58, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# C  [libglass.dylib+0x28e60]  -[GlassWindow(Overrides) windowDidResignKey:]+0xd4
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/kcr/dev/javafx/tmp/hs_err_pid61623.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#
0   libglass.dylib                      0x0000000128ce8e20 -[GlassWindow(Overrides) windowDidResignKey:] + 148
1   CoreFoundation                      0x000000018b4eb144 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
2   CoreFoundation                      0x000000018b57f3d8 ___CFXRegistrationPost_block_invoke + 88
3   CoreFoundation                      0x000000018b57f320 _CFXRegistrationPost + 440
4   CoreFoundation                      0x000000018b4b9678 _CFXNotificationPost + 768
5   Foundation                          0x000000018c5d64e4 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
6   AppKit                              0x000000018eeaf6fc -[NSWindow resignKeyWindow] + 640
7   AppKit                              0x000000018f812e3c -[NSWindow _orderOut:calculatingKeyWithOptions:documentWindow:] + 220
8   AppKit                              0x000000018ed968a4 NSPerformVisuallyAtomicChange + 108
9   AppKit                              0x000000018f814954 -[NSWindow _reallyDoOrderWindowOutRelativeTo:] + 448
10  AppKit                              0x000000018f814d24 -[NSWindow _reallyDoOrderWindow:] + 80
11  AppKit                              0x000000018f814f74 -[NSWindow _doOrderWindow:] + 264
12  AppKit                              0x000000018f81036c -[NSWindow _finishClosingWindow] + 472
13  AppKit                              0x000000018efdd7d0 -[NSWindow _close] + 408
14  libglass.dylib                      0x0000000128ce95c8 -[GlassWindow_Normal close] + 76
15  Foundation                          0x000000018c6463f4 __NSThreadPerformPerform + 264
16  CoreFoundation                      0x000000018b4f64d8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
17  CoreFoundation                      0x000000018b4f646c __CFRunLoopDoSource0 + 176
18  CoreFoundation                      0x000000018b4f623c __CFRunLoopDoSources0 + 340
19  CoreFoundation                      0x000000018b4f4dc8 __CFRunLoopRun + 828
20  CoreFoundation                      0x000000018b4f4434 CFRunLoopRunSpecific + 608
21  libjli.dylib                        0x00000001027591b0 CreateExecutionEnvironment + 400
22  libjli.dylib                        0x00000001027552a0 JLI_Launch + 1128
23  java                                0x00000001022cbbb4 main + 396
24  dyld                                0x000000018b08e0e0 start + 2360

Comments
A pull request was submitted for review. Branch: jfx23 URL: https://git.openjdk.org/jfx/pull/1511 Date: 2024-07-17 12:21:59 +0000
17-07-2024

Changeset: 81f11c4a Branch: master Author: Kevin Rushforth <kcr@openjdk.org> Date: 2024-07-17 12:15:21 +0000 URL: https://git.openjdk.org/jfx/commit/81f11c4a39eb505d17c57a49c5e084f75a169856
17-07-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jfx/pull/1506 Date: 2024-07-15 19:36:43 +0000
15-07-2024

Workaround: Close the stage or exit full screen before calling Platform.exit().
03-07-2024