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 1/2] 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() From 7139eea4c4ebf54e660b6edf0e9a4a690040289d Mon Sep 17 00:00:00 2001 From: Theasacraft <91694323+Thesacraft@users.noreply.github.com> Date: Mon, 29 Apr 2024 19:37:36 +0200 Subject: [PATCH 2/2] Ends threads before quitting application This fixes this warning: QThread: Destroyed while thread is still running --- tagstudio/src/qt/ts_qt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tagstudio/src/qt/ts_qt.py b/tagstudio/src/qt/ts_qt.py index 25a64fca..64ca645d 100644 --- a/tagstudio/src/qt/ts_qt.py +++ b/tagstudio/src/qt/ts_qt.py @@ -82,7 +82,7 @@ class Consumer(QThread): self.active = True while self.active: try: - job = self.queue.get() + job = self.queue.get(timeout=0.2) # print('Running job...') # logging.info(*job[1]) job[0](*job[1])