1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 15:04:36 +03:00

mux: avoid panic if prune_dead_windows is called indirectly

refs: #542
This commit is contained in:
Wez Furlong 2021-03-15 06:37:46 -07:00
parent 045c3d05a4
commit 2ea093170c

View File

@ -361,7 +361,13 @@ impl Mux {
let dead_tab_ids: Vec<TabId>; let dead_tab_ids: Vec<TabId>;
{ {
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() { for (window_id, win) in windows.iter_mut() {
win.prune_dead_tabs(&live_tab_ids); win.prune_dead_tabs(&live_tab_ids);
if win.is_empty() { if win.is_empty() {