File tree Expand file tree Collapse file tree 3 files changed +10
-8
lines changed
resources/edu/wpi/grip/ui Expand file tree Collapse file tree 3 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -127,8 +127,6 @@ public void start(Stage stage) throws IOException {
127127 }
128128 });
129129
130- // If this isn't here this can cause a deadlock on windows. See issue #297
131- stage .setOnCloseRequest (event -> SafeShutdown .exit (0 , Platform ::exit ));
132130 stage .setTitle (MAIN_TITLE );
133131 stage .getIcons ().add (new Image ("/edu/wpi/grip/ui/icons/grip.png" ));
134132 stage .setScene (new Scene (root ));
Original file line number Diff line number Diff line change @@ -120,6 +120,12 @@ protected void initialize() {
120120 statusLabel .setText ("Pipeline " + stateMessage );
121121 analyzeMenuItem .setDisable (state .equals (Service .State .TERMINATED ));
122122 }), Platform ::runLater );
123+ Platform .runLater (() -> root .getScene ().getWindow ().setOnCloseRequest (e -> {
124+ if (!quit ()) {
125+ // Asked to quit but cancelled, consume the event to avoid closing the window
126+ e .consume ();
127+ }
128+ }));
123129 }
124130
125131 /**
@@ -278,11 +284,13 @@ protected void showProjectAboutDialog() throws IOException {
278284 }
279285
280286 @ FXML
281- protected void quit () {
287+ protected boolean quit () {
282288 if (showConfirmationDialogAndWait ()) {
283289 pipelineRunner .stopAsync ();
284290 SafeShutdown .exit (0 );
291+ return true ;
285292 }
293+ return false ;
286294 }
287295
288296 /**
Original file line number Diff line number Diff line change 9898 </graphic >
9999 </MenuItem >
100100 <SeparatorMenuItem />
101- <MenuItem text =" Exit" onAction =" #quit" >
102- <accelerator >
103- <KeyCodeCombination alt =" UP" code =" Q" control =" UP" meta =" UP" shift =" UP" shortcut =" DOWN" />
104- </accelerator >
105- </MenuItem >
101+ <MenuItem text =" Exit" onAction =" #quit" />
106102 </Menu >
107103 <Menu text =" Tools" >
108104 <MenuItem text =" Deploy" onAction =" #deploy" >
You can’t perform that action at this time.
0 commit comments