From 87cb5935547779a8efbba1b497c7ff2f3220f00d Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 30 May 2021 23:50:13 -0700 Subject: [PATCH] mux: client would prune out the empty window when connecting via ssh/tls domain When the client connected to an empty remote mux, it would allocate an empty window and then spawn a new tab into it. Meanwhile, the authentication window would close and trigger a prune of all empty windows, causing the in-flight spawn to fail because its destination window was removed. This commit defers window pruning while Activity is in progress; the MuxWindowBuilder has an associated Activity count. --- mux/src/lib.rs | 3 +++ wezterm-gui/src/main.rs | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mux/src/lib.rs b/mux/src/lib.rs index b933ff20b..cfac22caf 100644 --- a/mux/src/lib.rs +++ b/mux/src/lib.rs @@ -426,6 +426,9 @@ impl Mux { } pub fn prune_dead_windows(&self) { + if Activity::count() > 0 { + return; + } let live_tab_ids: Vec = self.tabs.borrow().keys().cloned().collect(); let mut dead_windows = vec![]; let dead_tab_ids: Vec; diff --git a/wezterm-gui/src/main.rs b/wezterm-gui/src/main.rs index 1d09c2a7b..b3e83dcb3 100644 --- a/wezterm-gui/src/main.rs +++ b/wezterm-gui/src/main.rs @@ -269,8 +269,7 @@ async fn spawn_tab_in_default_domain_if_mux_is_empty( let config = config::configuration(); let window_id = mux.new_empty_window(); - let _tab = mux - .default_domain() + let _tab = domain .spawn(config.initial_size(), cmd, None, *window_id) .await?; Ok(())