diff --git a/fishy/engine/common/IEngine.py b/fishy/engine/common/IEngine.py index 445b03e..f51d220 100644 --- a/fishy/engine/common/IEngine.py +++ b/fishy/engine/common/IEngine.py @@ -23,7 +23,7 @@ class IEngine: # 0 - off, 1 - running, 2 - quitting self.state = 0 self.window = None - self.thread = None + self.thread: Thread = None @property def gui(self): @@ -47,6 +47,10 @@ class IEngine: self.thread = Thread(target=self._crash_safe) self.thread.start() + def join(self): + if self.thread: + self.thread.join() + def turn_off(self): """ this method only signals the thread to close using start flag, diff --git a/fishy/engine/common/event_handler.py b/fishy/engine/common/event_handler.py index 9472e5c..52d60ef 100644 --- a/fishy/engine/common/event_handler.py +++ b/fishy/engine/common/event_handler.py @@ -71,6 +71,8 @@ class EngineEventHandler(IEngineHandler): self.quit_me() def stop(self): + self.semi_fisher_engine.join() + self.full_fisher_engine.join() if self.update_flag: auto_update.update_now(self.to_version)