diff --git a/src/main/java/es/kauron/jstudy/controller/Controller.java b/src/main/java/es/kauron/jstudy/controller/Controller.java index 0b117a3..2181d38 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 59bb358..543e6a3 100644 --- a/src/main/java/es/kauron/jstudy/controller/TableController.java +++ b/src/main/java/es/kauron/jstudy/controller/TableController.java @@ -186,4 +186,11 @@ public class TableController implements Initializable { timerTask = null; } } + + void stopTimer() { + timer.cancel(); + timer.purge(); + if (timerTask != null) + timerTask.cancel(); + } }