From 4450dbaf4ed19b8d3fa9b5a18e9de50d129abe1f Mon Sep 17 00:00:00 2001 From: Cedric Spindler Date: Thu, 24 Aug 2023 17:14:56 +0200 Subject: [PATCH] Fix thread cancellation condition --- src/uploader_app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uploader_app.py b/src/uploader_app.py index 0413bd2..f2adf6e 100644 --- a/src/uploader_app.py +++ b/src/uploader_app.py @@ -271,7 +271,7 @@ def finishMeta(self): def toggleUploadThread(self): if not self.checkRootAvailable(): return - if not self.uploadWorker or (self.uploadWorker and isValid(self.uploadWorker)): + if not self.uploadWorker or (self.uploadWorker and not isValid(self.uploadWorker)): self.startUploadWorker() else: self.stopUploadWorker() @@ -474,13 +474,13 @@ def setupDb(self): c.close() def closeEvent(self, event): - if self.indexWorker and not isValid(self.indexWorker) and self.indexWorker.isRunning(): + if self.indexWorker and isValid(self.indexWorker) and self.indexWorker.isRunning(): self.stopIndexWorker() self.indexWorker.wait() - if self.metaWorker and not isValid(self.metaWorker) and self.metaWorker.isRunning(): + if self.metaWorker and isValid(self.metaWorker) and self.metaWorker.isRunning(): self.stopMetaWorker() self.metaWorker.wait() - if self.uploadWorker and not isValid(self.uploadWorker) and self.uploadWorker.isRunning(): + if self.uploadWorker and isValid(self.uploadWorker) and self.uploadWorker.isRunning(): self.stopUploadWorker() self.uploadWorker.wait() super(QMainWindow, self).closeEvent(event)