mirror of
https://github.com/cryptomator/cryptomator.git
synced 2024-11-23 20:19:41 +00:00
cancel background task, if window is closed
This commit is contained in:
parent
b895ac69fb
commit
43ad1c05c0
@ -131,7 +131,16 @@ public class CreateNewVaultLocationController implements FxController {
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
backgroundExecutor.submit(this::loadLocationPresets);
|
var task = backgroundExecutor.submit(this::loadLocationPresets);
|
||||||
|
var onHiddenAction = window.getOnHidden();
|
||||||
|
if(onHiddenAction != null) {
|
||||||
|
window.setOnHidden(evt -> {
|
||||||
|
task.cancel(true);
|
||||||
|
onHiddenAction.handle(evt);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
window.setOnHidden(_ -> task.cancel(true));
|
||||||
|
}
|
||||||
locationPresetsToggler.selectedToggleProperty().addListener(this::togglePredefinedLocation);
|
locationPresetsToggler.selectedToggleProperty().addListener(this::togglePredefinedLocation);
|
||||||
usePresetPath.bind(locationPresetsToggler.selectedToggleProperty().isNotEqualTo(customRadioButton));
|
usePresetPath.bind(locationPresetsToggler.selectedToggleProperty().isNotEqualTo(customRadioButton));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user