Skip to content

Commit 2de1f9c

Browse files
committed
refactor(gui): remove redundant hasattr check in _terminate_process
1 parent 0efb9bd commit 2de1f9c

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

basilisk/gui/conversation_tab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ def _terminate_process(
10211021
log.warning("%s did not terminate, killing it", process_name)
10221022
process.kill()
10231023
# Give killed process a brief chance to be reaped
1024-
if hasattr(process, 'join') and process.is_alive():
1024+
if process.is_alive():
10251025
process.join(timeout=0.5)
10261026
except Exception as e:
10271027
log.error(

basilisk/gui/main_frame.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,18 @@ def on_close_conversation(self, event: wx.Event | None):
651651
current_tab = self.tabs_panels[current_tab_index]
652652

653653
# Clean up running resources for this tab only before closing
654-
current_tab.cleanup_resources()
654+
try:
655+
current_tab.cleanup_resources()
656+
except Exception as e:
657+
# Log error but proceed to remove tab
658+
log.error(
659+
"Error cleaning up resources for tab at index %d: %s",
660+
current_tab_index,
661+
e,
662+
exc_info=True,
663+
)
655664

656-
# Remove the tab from the notebook and tabs list
665+
# Remove the tab from the notebook and tabs list (always, even if cleanup failed)
657666
self.notebook.DeletePage(current_tab_index)
658667
self.tabs_panels.pop(current_tab_index)
659668

0 commit comments

Comments
 (0)