Ignore errors in do_window_cleanup to fix shutdown issue (#3142)

* Ignore errors in do_window_cleanup to fix shutdown issue

* Only catch RuntimeError
This commit is contained in:
Abdo 2024-04-17 13:50:41 +03:00 committed by GitHub
parent 351aa96dfc
commit 0a706c5dd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 14 deletions

View File

@ -232,20 +232,24 @@ class ProgressManager:
next_levels = self._levels - 1
next_levels = max(0, next_levels)
if next_levels == 0:
if self._win:
self._closeWin()
if self._busy_cursor_timer:
self._busy_cursor_timer.stop()
self._busy_cursor_timer = None
self._restore_cursor()
if self._show_timer:
self._show_timer.stop()
self._show_timer = None
if self._backend_timer:
self._backend_timer.stop()
self._backend_timer.deleteLater()
self._backend_timer = None
try:
if next_levels == 0:
if self._win:
self._closeWin()
if self._busy_cursor_timer:
self._busy_cursor_timer.stop()
self._busy_cursor_timer = None
self._restore_cursor()
if self._show_timer:
self._show_timer.stop()
self._show_timer = None
if self._backend_timer:
self._backend_timer.stop()
self._backend_timer.deleteLater()
self._backend_timer = None
except RuntimeError as exc:
# during shutdown, the timers may have already been deleted by Qt
print(f"do_window_cleanup error ignored: {exc}")
self._levels = next_levels
# if the window is not currently shown, we can do cleanup immediately, if it is