v1.8.2: session management hardening
- Fix infinite reconnect loop in terminal (_send_to_shell guard) - Safe language switch: disconnect + reconnect instead of object transplant - Improved SFTP reconnect flow with proper validation - Add log.debug to all silent exception handlers in ssh_client Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
33
gui/app.py
33
gui/app.py
@@ -171,15 +171,14 @@ class App(ctk.CTk):
|
||||
# Use provided key or default to first tab
|
||||
current_key = restore_tab_key or self._tab_keys[0]
|
||||
|
||||
# Save live SFTP session before destroying tabs
|
||||
saved_sftp = self.files_tab._sftp
|
||||
saved_sftp_path = self.files_tab._remote_path
|
||||
saved_sftp_alias = self.files_tab._current_alias
|
||||
# Save state before destroying tabs
|
||||
saved_remote_path = self.files_tab._remote_path
|
||||
saved_local_path = self.files_tab._local_path
|
||||
self.files_tab._sftp = None # Prevent disconnect on destroy
|
||||
had_sftp = self.files_tab._sftp is not None and self.files_tab._sftp.connected
|
||||
|
||||
# Disconnect terminal before destroying tabs
|
||||
# Disconnect terminal and SFTP before destroying tabs
|
||||
self.terminal_tab._disconnect()
|
||||
self.files_tab._disconnect_sftp()
|
||||
|
||||
# Detach tab contents
|
||||
self.terminal_tab.pack_forget()
|
||||
@@ -225,23 +224,17 @@ class App(ctk.CTk):
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Restore SFTP session without reconnecting
|
||||
if saved_sftp and saved_sftp.connected:
|
||||
self.files_tab._sftp = saved_sftp
|
||||
self.files_tab._current_alias = saved_sftp_alias
|
||||
self.files_tab._remote_path = saved_sftp_path
|
||||
self.files_tab._local_path = saved_local_path
|
||||
self.files_tab._set_remote_buttons_state("normal")
|
||||
self.files_tab._remote_status.configure(
|
||||
text=t("connected_sftp").format(alias=saved_sftp_alias)
|
||||
)
|
||||
self.files_tab._refresh_local()
|
||||
self.files_tab._refresh_remote()
|
||||
# Restore file paths and reconnect properly
|
||||
self.files_tab._local_path = saved_local_path
|
||||
self.files_tab._refresh_local()
|
||||
if alias and had_sftp:
|
||||
# Had active SFTP — reconnect and restore remote path
|
||||
self.files_tab._remote_path = saved_remote_path
|
||||
self.files_tab.set_server(alias)
|
||||
elif alias:
|
||||
# No live session — reconnect via server selection
|
||||
self.files_tab.set_server(alias)
|
||||
|
||||
# Restore server selection for other tabs
|
||||
# Restore server selection for other tabs (terminal auto-reconnects)
|
||||
if alias:
|
||||
self.terminal_tab.set_server(alias)
|
||||
self.info_tab.set_server(alias)
|
||||
|
||||
Reference in New Issue
Block a user