A DESCRIPTION OF THE PROBLEM :
The bug I report seems to be fixed in JDK-8211304, but only in Java 12. Please fix it also in Java 11.
This is a major bug for all JavaFx applications running on MacOs.
This is a Java crash on Mac OS Mojave, the stack trace is below.
I have also attached a small application you can run. Just open the dialog and then switch few times to another application ( alt-tab). The crash will reproduce.
018-12-09 08:47:08.653 java[13845:734283] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: _type > 0 && _type <= kCGSLastEventType'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff520b543d __exceptionPreprocess + 256
1 libobjc.A.dylib 0x00007fff7dfc2720 objc_exception_throw + 48
2 CoreFoundation 0x00007fff520d008e +[NSException raise:format:arguments:] + 98
3 Foundation 0x00007fff5446c55d -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 AppKit 0x00007fff4f55bacd -[NSEvent _initWithCGEvent:eventRef:] + 3272
5 AppKit 0x00007fff4f8af188 +[NSEvent eventWithCGEvent:] + 120
6 libglass.dylib 0x000000012467bf3b listenTouchEvents + 59
7 SkyLight 0x00007fff78080782 _ZL19processEventTapDataPvjjjPhj + 148
8 SkyLight 0x00007fff77f7fbb2 _XPostEventTapData + 278
9 SkyLight 0x00007fff78080690 _ZL22eventTapMessageHandlerP12__CFMachPortPvlS1_ + 132
10 CoreFoundation 0x00007fff52013a5b __CFMachPortPerform + 246
11 CoreFoundation 0x00007fff52013959 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
12 CoreFoundation 0x00007fff520138b7 __CFRunLoopDoSource1 + 527
13 CoreFoundation 0x00007fff51ffb945 __CFRunLoopRun + 2574
14 CoreFoundation 0x00007fff51fface4 CFRunLoopRunSpecific + 463
15 Foundation 0x00007fff5435b5da -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 280
16 libglass.dylib 0x00000001246709f5 +[GlassApplication enterNestedEventLoopWithEnv:] + 165
17 libglass.dylib 0x000000012467148a Java_com_sun_glass_ui_mac_MacApplication__1enterNestedEventLoopImpl + 74
18 ??? 0x000000010793a950 0x0 + 4422084944
19 ??? 0x0000000107934a00 0x0 + 4422060544
20 ??? 0x0000000107934a00 0x0 + 4422060544
21 ??? 0x0000000107934a00 0x0 + 4422060544
)
libc++abi.dylib: terminating with uncaught exception of type NSException
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
public class SampleAppWithButton extends Application {
private final StackPane root = new StackPane();
private final Scene scene = new Scene(root, 300, 250);
@Override
public void start(Stage stage) {
stage.setTitle("Sample Canvas");
final Button btn = new Button("Show Dialog");
btn.setOnAction(e -> showDialog());
VBox pane = new VBox();
pane.getChildren().addAll(btn);
root.getChildren().add(pane);
stage.setScene(scene);
stage.sizeToScene();
stage.show();
}
private void showDialog() {
final Dialog dialog = new Dialog();
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.initOwner(scene.getWindow());
dialog.setResizable(true);
dialog.setTitle("UID Setup");
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
dialog.showAndWait();
Node okButton = dialog.getDialogPane().lookupButton(ButtonType.OK);
}
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
FREQUENCY : often