Fix memory leak caused by minimizing to tray
This commit is contained in:
parent
5d3b8e2790
commit
adbb1bd562
|
@ -1,6 +1,10 @@
|
|||
4.4.2
|
||||
========================
|
||||
* Fixed memory leak caused by minimizing to tray
|
||||
|
||||
4.4.1
|
||||
========================
|
||||
* Fix camsoda stream URLs
|
||||
* Fixed camsoda stream URLs
|
||||
|
||||
4.4.0
|
||||
========================
|
||||
|
|
|
@ -151,6 +151,14 @@ public class CamrecApplication extends Application {
|
|||
LOG.error(ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
if (Objects.equals("stage_restored", evt.get("event"))) {
|
||||
LOG.debug("Main stage restored");
|
||||
Platform.runLater(() -> {
|
||||
if (tabPane.getSelectionModel().getSelectedItem() instanceof TabSelectionListener) {
|
||||
((TabSelectionListener) tabPane.getSelectionModel().getSelectedItem()).selected();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -289,8 +297,16 @@ public class CamrecApplication extends Application {
|
|||
primaryStage.iconifiedProperty().addListener((obs, oldV, newV) -> {
|
||||
if (newV.booleanValue() && Config.getInstance().getSettings().minimizeToTray && primaryStage.isShowing()) {
|
||||
DesktopIntegration.minimizeToTray(primaryStage);
|
||||
suspendTabUpdates();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void suspendTabUpdates() {
|
||||
tabPane.getTabs().stream()
|
||||
.filter(TabSelectionListener.class::isInstance)
|
||||
.forEach(t -> ((TabSelectionListener)t).deselected());
|
||||
}
|
||||
|
||||
private javafx.event.EventHandler<WindowEvent> createShutdownHandler() {
|
||||
|
|
|
@ -262,6 +262,7 @@ public class DesktopIntegration {
|
|||
stage.setIconified(false);
|
||||
stage.show();
|
||||
stage.toFront();
|
||||
EventBusHolder.BUS.post(Map.of("event", "stage_restored"));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue