From a54d37aa45a915a1223476e58331a020ee5a3154 Mon Sep 17 00:00:00 2001 From: Fabian Freyer Date: Sat, 2 Apr 2022 03:35:25 +0200 Subject: Finish a BackgroundTaskThread on exception Fixes #1431 --- python/plugin.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'python/plugin.py') 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) -- cgit v1.3.1