diff options
| author | Fabian Freyer <fabian.freyer@physik.tu-berlin.de> | 2022-04-02 03:35:25 +0200 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2022-04-24 10:04:25 -0400 |
| commit | a54d37aa45a915a1223476e58331a020ee5a3154 (patch) | |
| tree | 6d01274e7b5883d4968f0f61095e1a5770b87616 /python | |
| parent | 7051f9fecd395ddae07ee3b49785b1895e8206e1 (diff) | |
Finish a BackgroundTaskThread on exception
Fixes #1431
Diffstat (limited to 'python')
| -rw-r--r-- | python/plugin.py | 8 |
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) |
