From 41e419c1e7cbf6c86c1b0fe6963312a3417927b3 Mon Sep 17 00:00:00 2001 From: Theasacraft <91694323+Thesacraft@users.noreply.github.com> Date: Mon, 29 Apr 2024 18:46:35 +0200 Subject: [PATCH] Ends threads before quitting application This fixes this warning: QThread: Destroyed while thread is still running --- tagstudio/src/qt/ts_qt.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tagstudio/src/qt/ts_qt.py b/tagstudio/src/qt/ts_qt.py index 0127f357..25a64fca 100644 --- a/tagstudio/src/qt/ts_qt.py +++ b/tagstudio/src/qt/ts_qt.py @@ -79,7 +79,8 @@ class Consumer(QThread): QThread.__init__(self) def run(self): - while True: + self.active = True + while self.active: try: job = self.queue.get() # print('Running job...') @@ -411,6 +412,11 @@ class QtDriver(QObject): self.save_library() self.settings.setValue("last_library", self.lib.library_dir) self.settings.sync() + logging.info("[SHUTDOWN] Ending Thumbnail Threads...") + for thread in self.thumb_threads: + thread.active=False + thread.quit() + thread.wait() QApplication.quit()