Skip to content

Commit 0efb9bd

Browse files
committed
fix(gui): add error handling to _cleanup_all_tabs
1 parent 9ad7aab commit 0efb9bd

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

basilisk/gui/main_frame.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,21 @@ def _cleanup_all_tabs(self):
409409
This helper method is used by on_quit to clean up all tabs when
410410
closing the application. For closing a single tab, use
411411
tab.cleanup_resources() directly.
412+
413+
Each tab's cleanup is wrapped in try/except to ensure all tabs
414+
get cleaned up even if one fails.
412415
"""
413-
for tab in self.tabs_panels:
414-
tab.cleanup_resources()
416+
for index, tab in enumerate(self.tabs_panels):
417+
try:
418+
tab.cleanup_resources()
419+
except Exception as e:
420+
# Log error but continue cleaning up other tabs
421+
log.error(
422+
"Error cleaning up resources for tab at index %d: %s",
423+
index,
424+
e,
425+
exc_info=True,
426+
)
415427

416428
def on_close(self, event: wx.Event | None):
417429
"""Handle the close event for the main application frame.

0 commit comments

Comments
 (0)