From de0b267568fadd9caf80ada99f4b6e551aca8535 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Tue, 2 Nov 2021 23:59:08 -0700 Subject: [PATCH] Shut down the sim update thread on quit. Otherwise the update thread just sits there waiting forever... --- qt_ui/simcontroller.py | 3 +++ qt_ui/windows/QLiberationWindow.py | 1 + 2 files changed, 4 insertions(+) diff --git a/qt_ui/simcontroller.py b/qt_ui/simcontroller.py index 33af32cb..fbfb88b5 100644 --- a/qt_ui/simcontroller.py +++ b/qt_ui/simcontroller.py @@ -44,6 +44,9 @@ class SimController(QObject): self.recreate_game_loop(game) self.sim_speed_reset.emit(SimSpeedSetting.PAUSED) + def shut_down(self) -> None: + self._sim_update_thread.stop() + def recreate_game_loop(self, game: Optional[Game]) -> None: if self.game_loop is not None: self._sim_update_thread.on_sim_pause() diff --git a/qt_ui/windows/QLiberationWindow.py b/qt_ui/windows/QLiberationWindow.py index bc9ae7b8..05f5564a 100644 --- a/qt_ui/windows/QLiberationWindow.py +++ b/qt_ui/windows/QLiberationWindow.py @@ -389,6 +389,7 @@ class QLiberationWindow(QMainWindow): QMessageBox.Yes | QMessageBox.No, ) if result == QMessageBox.Yes: + self.sim_controller.shut_down() super().closeEvent(event) self.dialog = None else: