diff --git a/mux/src/lib.rs b/mux/src/lib.rs index 46e915a95..13555459a 100644 --- a/mux/src/lib.rs +++ b/mux/src/lib.rs @@ -361,7 +361,13 @@ impl Mux { let dead_tab_ids: Vec; { - let mut windows = self.windows.borrow_mut(); + let mut windows = match self.windows.try_borrow_mut() { + Ok(w) => w, + Err(_) => { + // It's ok if our caller already locked it; we can prune later. + return; + } + }; for (window_id, win) in windows.iter_mut() { win.prune_dead_tabs(&live_tab_ids); if win.is_empty() {