diff --git a/src/main/java/es/kauron/jstudy/controller/Controller.java b/src/main/java/es/kauron/jstudy/controller/Controller.java index 0dd004d..4eb3edf 100644 --- a/src/main/java/es/kauron/jstudy/controller/Controller.java +++ b/src/main/java/es/kauron/jstudy/controller/Controller.java @@ -77,6 +77,8 @@ public class Controller implements Initializable { root.getScene().getWindow().setOnCloseRequest(event -> { for (Tab tab : tabPane.getTabs()) { EventHandler handler = tab.getOnCloseRequest(); + if (tabMap.containsKey(tab)) + tabMap.get(tab).stopTimer(); if (tab.isClosable() && handler != null) { tabPane.getSelectionModel().select(tab); handler.handle(event); diff --git a/src/main/java/es/kauron/jstudy/controller/TableController.java b/src/main/java/es/kauron/jstudy/controller/TableController.java index 693028b..ef7ea9c 100644 --- a/src/main/java/es/kauron/jstudy/controller/TableController.java +++ b/src/main/java/es/kauron/jstudy/controller/TableController.java @@ -209,4 +209,11 @@ public class TableController implements Initializable { timerTask = null; } } + + void stopTimer() { + timer.cancel(); + timer.purge(); + if (timerTask != null) + timerTask.cancel(); + } }