Shut down the sim update thread on quit.

Otherwise the update thread just sits there waiting forever...
This commit is contained in:
Dan Albert 2021-11-02 23:59:08 -07:00
parent 03430a4df5
commit de0b267568
2 changed files with 4 additions and 0 deletions

View File

@ -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()

View File

@ -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: