Ends threads before quitting application

This fixes this warning:
QThread: Destroyed while thread is still running
This commit is contained in:
Theasacraft 2024-04-29 18:46:35 +02:00 committed by GitHub
parent 93177dd696
commit 41e419c1e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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