mirror of
https://github.com/wez/wezterm.git
synced 2024-12-25 06:12:16 +03:00
fix panic when spawning invalid command via reused gui instance
refs: #1696
This commit is contained in:
parent
d5998ccb56
commit
ce3dd00444
@ -34,7 +34,7 @@ impl wezterm_term::Clipboard for ClipboardHelper {
|
||||
}
|
||||
|
||||
impl TermWindow {
|
||||
pub fn setup_clipboard(window: &Window, mux_window_id: MuxWindowId) {
|
||||
pub fn setup_clipboard(window: &Window, mux_window_id: MuxWindowId) -> anyhow::Result<()> {
|
||||
let clipboard: Arc<dyn wezterm_term::Clipboard> = Arc::new(ClipboardHelper {
|
||||
window: window.clone(),
|
||||
});
|
||||
@ -42,7 +42,9 @@ impl TermWindow {
|
||||
Arc::new(crate::download::Downloader::new());
|
||||
let mux = Mux::get().unwrap();
|
||||
|
||||
let mut mux_window = mux.get_window_mut(mux_window_id).unwrap();
|
||||
let mut mux_window = mux
|
||||
.get_window_mut(mux_window_id)
|
||||
.ok_or_else(|| anyhow::anyhow!("mux doesn't know about window yet!?"))?;
|
||||
|
||||
mux_window.set_clipboard(&clipboard);
|
||||
for tab in mux_window.iter() {
|
||||
@ -51,6 +53,8 @@ impl TermWindow {
|
||||
pos.pane.set_download_handler(&downloader);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn copy_to_clipboard(&self, clipboard: ClipboardCopyDestination, text: String) {
|
||||
|
@ -778,7 +778,7 @@ impl TermWindow {
|
||||
tw.borrow_mut().window.replace(window.clone());
|
||||
|
||||
Self::apply_icon(&window)?;
|
||||
Self::setup_clipboard(&window, mux_window_id);
|
||||
Self::setup_clipboard(&window, mux_window_id)?;
|
||||
|
||||
let config_subscription = config::subscribe_to_config_reload({
|
||||
let window = window.clone();
|
||||
|
Loading…
Reference in New Issue
Block a user