From 3ca3b3196e6231683441d759d512885892b9a014 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Fri, 25 Oct 2019 08:26:38 -0700 Subject: [PATCH] clean up process death detection on windows w/ new frontend --- src/mux/mod.rs | 14 ++++++++++++-- src/mux/window.rs | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/mux/mod.rs b/src/mux/mod.rs index 56fd11f52..18240c438 100644 --- a/src/mux/mod.rs +++ b/src/mux/mod.rs @@ -230,8 +230,19 @@ impl Mux { } } + let dead_tab_ids: Vec = self + .tabs + .borrow() + .iter() + .filter_map(|(&id, tab)| if tab.is_dead() { Some(id) } else { None }) + .collect(); + + for tab_id in dead_tab_ids { + self.tabs.borrow_mut().remove(&tab_id); + } + for window_id in dead_windows { - debug!("removing window {}", window_id); + error!("removing window {}", window_id); windows.remove(&window_id); } } @@ -274,7 +285,6 @@ impl Mux { Ok(()) } - #[allow(dead_code)] pub fn is_empty(&self) -> bool { self.tabs.borrow().is_empty() } diff --git a/src/mux/window.rs b/src/mux/window.rs index aac446001..77fe3611e 100644 --- a/src/mux/window.rs +++ b/src/mux/window.rs @@ -89,6 +89,21 @@ impl Window { } pub fn prune_dead_tabs(&mut self, live_tab_ids: &[TabId]) { + let dead: Vec = self + .tabs + .iter() + .filter_map(|tab| { + if tab.is_dead() { + Some(tab.tab_id()) + } else { + None + } + }) + .collect(); + for tab_id in dead { + self.remove_by_id(tab_id); + } + let dead: Vec = self .tabs .iter()