mirror of
https://github.com/wez/wezterm.git
synced 2025-01-08 23:17:36 +03:00
mux: fix stale local/remote window id mapping in mux client
When closing the all mux tabs in a window, the remote will close the window. If the local has a mixture of local and remote tabs then subsequent attempts to spawn a tab in that window would fail due to reusing the stale remote window id. This commit purges the local/remote mappings that are (probably) dead when the remote indicates that a pane has been removed. The mapping should be re-established as needed later on. refs: https://github.com/wez/wezterm/issues/2614
This commit is contained in:
parent
de466cfa64
commit
4d598eb1ad
@ -78,6 +78,9 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
[#2559](https://github.com/wez/wezterm/issues/2559)
|
||||
* Missing validation of conflicting domain names
|
||||
[#2618](https://github.com/wez/wezterm/issues/2618)
|
||||
* Creating tabs in a multiplexing domain could fail after previously closing
|
||||
all tabs connected to that domain in that window
|
||||
[#2614](https://github.com/wez/wezterm/issues/2614)
|
||||
|
||||
#### Changed
|
||||
* Removed Last Resort fallback font
|
||||
|
@ -37,6 +37,51 @@ impl ClientInner {
|
||||
map.get(&remote_window_id).cloned()
|
||||
}
|
||||
|
||||
pub(crate) fn expire_stale_mappings(&self) {
|
||||
let mux = Mux::get().unwrap();
|
||||
|
||||
self.remote_to_local_pane
|
||||
.lock()
|
||||
.unwrap()
|
||||
.retain(|_remote_pane_id, local_pane_id| mux.get_pane(*local_pane_id).is_some());
|
||||
|
||||
self.remote_to_local_tab
|
||||
.lock()
|
||||
.unwrap()
|
||||
.retain(
|
||||
|_remote_tab_id, local_tab_id| match mux.get_tab(*local_tab_id) {
|
||||
Some(tab) => {
|
||||
for pos in tab.iter_panes_ignoring_zoom() {
|
||||
if pos.pane.domain_id() == self.local_domain_id {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
None => false,
|
||||
},
|
||||
);
|
||||
|
||||
self.remote_to_local_window
|
||||
.lock()
|
||||
.unwrap()
|
||||
.retain(
|
||||
|_remote_window_id, local_window_id| match mux.get_window(*local_window_id) {
|
||||
Some(w) => {
|
||||
for tab in w.iter() {
|
||||
for pos in tab.iter_panes_ignoring_zoom() {
|
||||
if pos.pane.domain_id() == self.local_domain_id {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
None => false,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
fn record_remote_to_local_window_mapping(
|
||||
&self,
|
||||
remote_window_id: WindowId,
|
||||
|
@ -168,6 +168,8 @@ impl ClientPane {
|
||||
self.renderable.borrow().inner.borrow_mut().dead = true;
|
||||
let mux = Mux::get().unwrap();
|
||||
mux.prune_dead_windows();
|
||||
|
||||
self.client.expire_stale_mappings();
|
||||
}
|
||||
_ => bail!("unhandled unilateral pdu: {:?}", pdu),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user