-
Bug
-
Resolution: Fixed
-
P2
-
jfx11, 8u261, jfx14
-
x86
-
os_x
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8281657 | jfx17.0.3 | Kevin Rushforth | P2 | Resolved | Fixed | |
JDK-8280411 | 8u331 | Kevin Rushforth | P2 | Closed | Fixed | b04 |
JDK-8281975 | jfx11.0.15 | Kevin Rushforth | P2 | Resolved | Fixed |
Tested on HighSierra (10.13.6) and (Catalina 10.15.3) and the application crashes on both.
Java 14
JavaFx 13, JavaFx 14
A DESCRIPTION OF THE PROBLEM :
When adding an event handler that is closing the dialog via CMD+ENTER or CTRL+ENTER key combination, this crashes the entire application on MacOs.
This does NOT happen on Windows or Linux.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Click launch dialog button (the dialog should open)
2. Press ALT+ENTER (the dialog should be closed)
3. Click launch dialog button again (the dialog should open)
4. Press CMD+ENTER
5. The application will crash
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Application should not crash.
ACTUAL -
2020-04-09 20:18:49.116 java[788:13938] CGLChoosePixelFormat: No matching pixel format exists for the requested attributes, trying again with limited capabilities
ALT + ENTER
Apply processed
2020-04-09 20:18:52.754 java[788:13938] CGLChoosePixelFormat: No matching pixel format exists for the requested attributes, trying again with limited capabilities
META + ENTER
Apply processed
2020-04-09 20:18:53.838 java[788:13938] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff563cd66b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fff7d6da942 objc_exception_throw + 48
2 CoreFoundation 0x00007fff5640d77c _CFThrowFormattedException + 194
3 CoreFoundation 0x00007fff562f008f -[__NSArrayM objectAtIndex:] + 175
4 AppKit 0x00007fff53b041a8 -[NSView performKeyEquivalent:] + 172
5 AppKit 0x00007fff541ab0f7 -[NSWindow _commonPerformKeyEquivalent:conditionally:] + 79
6 libglass.dylib 0x0000000126a1ae30 -[GlassWindow_Normal performKeyEquivalent:] + 64
7 AppKit 0x00007fff540704fb routeKeyEquivalent + 454
8 AppKit 0x00007fff5406dce0 -[NSApplication(NSEvent) sendEvent:] + 1096
9 libglass.dylib 0x0000000126a0a435 +[GlassApplication enterNestedEventLoopWithEnv:] + 213
10 libglass.dylib 0x0000000126a0aeaa Java_com_sun_glass_ui_mac_MacApplication__1enterNestedEventLoopImpl + 74
11 ??? 0x00000001119e16b0 0x0 + 4590540464
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 134 (Exit value: 134)
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
public class CrashMe extends Application {
@Override
public void start(Stage stage) {
////////////////////////////////////////
// create main screen
////////////////////////////////////////
Button launchButton = new Button("Launch dialog");
VBox vbox = new VBox(launchButton);
Scene scene = new Scene(new StackPane(vbox), 640, 480);
stage.setScene(scene);
////////////////////////////////////////
// dialog which crashes the application
////////////////////////////////////////
Button clickMe = new Button("Close dialog");
BorderPane pane = new BorderPane(clickMe);
Dialog dialog = new Dialog(stage, pane);
Runnable dialogApply = () -> {
System.out.println("Apply processed");
dialog.close();
};
dialog.setApply(dialogApply);
clickMe.setOnAction(e -> dialogApply.run());
////////////////////////////////////////
// wire button on main screen to launch the dialog
////////////////////////////////////////
launchButton.setOnAction(e -> {
dialog.showAndWait();
});
stage.show();
}
public static void main(String[] args) {
launch();
}
public static class Dialog extends Stage {
private Runnable apply;
public Dialog(Stage owner, Parent layout) {
super(StageStyle.DECORATED);
Scene layoutScene = new Scene(layout, 500, 500);
this.setScene(layoutScene);
layoutScene.addEventHandler(KeyEvent.KEY_PRESSED, event -> {
if (event.getCode() == KeyCode.ENTER && event.isShortcutDown()) {
// this crashes the app on MacOs
System.out.println("META + ENTER");
if (apply != null) {
apply.run();
}
event.consume();
return;
}
if (event.getCode() == KeyCode.ENTER && event.isAltDown()) {
// this does not crash the app on MacOs
System.out.println("ALT + ENTER");
if (apply != null) {
apply.run();
}
event.consume();
return;
}
});
this.hide();
this.initModality(Modality.APPLICATION_MODAL);
this.initOwner(owner);
this.setResizable(true);
}
public void setApply(Runnable apply) {
this.apply = apply;
}
@Override
public void close() {
super.close();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
ALT+ENTER does not crash the application
Clicking directly on button does not crash the application
FREQUENCY : always
- backported by
-
JDK-8281657 CMD+ENTER key event crashes the application when invoked on dialog
- Resolved
-
JDK-8281975 CMD+ENTER key event crashes the application when invoked on dialog
- Resolved
-
JDK-8280411 CMD+ENTER key event crashes the application when invoked on dialog
- Closed
- blocks
-
JDK-8205915 [macOS] Accelerator assigned to button in dialog fires menuItem in owning stage
- Resolved
- links to
-
Commit openjdk/jfx11u/fdb50f28
-
Commit openjdk/jfx17u/b0ae8b6b
-
Commit openjdk/jfx/a2a0acff
-
Review openjdk/jfx11u/72
-
Review openjdk/jfx17u/32
-
Review openjdk/jfx/704
-
Review openjdk/jfx/714