Skip to content

Commit

Permalink
Fix thread cancellation condition
Browse files Browse the repository at this point in the history
  • Loading branch information
csaudiodesign committed Aug 24, 2023
1 parent dbc63de commit 4450dba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/uploader_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4450dba

Please sign in to comment.