Skip to content

Commit

Permalink
close_widgets_and_quit: ignore deleted widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed Nov 21, 2023
1 parent a601b28 commit f365f0e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion guidata/qthelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,11 @@ def close_widgets_and_quit(screenshot: bool = False) -> None:
screenshot (bool): If True, save a screenshot of each widget
"""
for widget in QW.QApplication.instance().topLevelWidgets():
wname = widget.objectName()
try:
wname = widget.objectName()
except RuntimeError:
# Widget has been deleted
continue
if screenshot and wname and widget.isVisible(): # pragma: no cover
grab_save_window(widget, wname.lower())
assert widget.close()
Expand Down

0 comments on commit f365f0e

Please sign in to comment.