summaryrefslogtreecommitdiff
path: root/python/plugin.py
diff options
context:
space:
mode:
authorFabian Freyer <fabian.freyer@physik.tu-berlin.de>2022-04-02 03:35:25 +0200
committerPeter LaFosse <peter@vector35.com>2022-04-24 10:04:25 -0400
commita54d37aa45a915a1223476e58331a020ee5a3154 (patch)
tree6d01274e7b5883d4968f0f61095e1a5770b87616 /python/plugin.py
parent7051f9fecd395ddae07ee3b49785b1895e8206e1 (diff)
Finish a BackgroundTaskThread on exception
Fixes #1431
Diffstat (limited to 'python/plugin.py')
-rw-r--r--python/plugin.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/python/plugin.py b/python/plugin.py
index 741fe4a1..f1720ccd 100644
--- a/python/plugin.py
+++ b/python/plugin.py
@@ -924,9 +924,11 @@ class BackgroundTaskThread(BackgroundTask):
def run(self):
if self.task is None:
raise Exception("Can not call run more than once per thread")
- self.task.run()
- self.task.finish()
- self.task = None
+ try:
+ self.task.run()
+ finally:
+ self.task.finish()
+ self.task = None
BackgroundTask.__init__(self, initial_progress_text, can_cancel)
self.thread = _Thread(self)