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 {
127
127
}
128
128
});
129
129
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 ));
132
130
stage .setTitle (MAIN_TITLE );
133
131
stage .getIcons ().add (new Image ("/edu/wpi/grip/ui/icons/grip.png" ));
134
132
stage .setScene (new Scene (root ));
Original file line number Diff line number Diff line change @@ -120,6 +120,12 @@ protected void initialize() {
120
120
statusLabel .setText ("Pipeline " + stateMessage );
121
121
analyzeMenuItem .setDisable (state .equals (Service .State .TERMINATED ));
122
122
}), 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
+ }));
123
129
}
124
130
125
131
/**
@@ -278,11 +284,13 @@ protected void showProjectAboutDialog() throws IOException {
278
284
}
279
285
280
286
@ FXML
281
- protected void quit () {
287
+ protected boolean quit () {
282
288
if (showConfirmationDialogAndWait ()) {
283
289
pipelineRunner .stopAsync ();
284
290
SafeShutdown .exit (0 );
291
+ return true ;
285
292
}
293
+ return false ;
286
294
}
287
295
288
296
/**
Original file line number Diff line number Diff line change 98
98
</graphic >
99
99
</MenuItem >
100
100
<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" />
106
102
</Menu >
107
103
<Menu text =" Tools" >
108
104
<MenuItem text =" Deploy" onAction =" #deploy" >
You can’t perform that action at this time.
0 commit comments