From d8460d354a6c6ac226926f045bddef74667d85cd Mon Sep 17 00:00:00 2001 From: Jakub Fidler <31575114+RisingOrange@users.noreply.github.com> Date: Mon, 10 Mar 2025 08:17:50 +0100 Subject: [PATCH] fix: Task manager exception handling (#3839) * Raise exception from closures in run_in_background using run_on_main * Add author to CONTRIBUTORS file * Undo taskman changes * Raise exceptions from _on_closures_pending using singleShot --- CONTRIBUTORS | 1 + qt/aqt/taskman.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 0fb4726d2..a538aa6c3 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -213,6 +213,7 @@ GithubAnon0000 Mike Hardy Danika_Dakika Mumtaz Hajjo Alrifai +Jakub Fidler ******************** diff --git a/qt/aqt/taskman.py b/qt/aqt/taskman.py index b1e97637e..2ca1c6670 100644 --- a/qt/aqt/taskman.py +++ b/qt/aqt/taskman.py @@ -144,4 +144,11 @@ class TaskManager(QObject): self._closures = [] for closure in closures: - closure() + try: + closure() + except Exception as e: + + def raise_exception(exception=e) -> None: + raise exception + + QTimer.singleShot(0, raise_exception)