From 7aa611f4cb8be5ce458cccbff55ae357104fb704 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 16 Apr 2023 12:23:00 -0700 Subject: [PATCH] windows: fix linger wezterm-gui when closing with overlay active refs: #3522 --- docs/changelog.md | 2 ++ wezterm-gui/src/termwindow/mod.rs | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index 69c5979ec..78b8121ec 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -41,6 +41,8 @@ As features stabilize some brief notes about them will accumulate here. sequences from a `format-tab-title` event handler. #3481 * Windows: clicking the maximize button didn't work unless using integrated titlebar buttons. #3499 +* Windows: closing a window while the debug overlay was active could + leave a lingering wezterm-gui.exe running. #3522 ### 20230408-112425-69ae8472 diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rs index 85eaacc7a..5e8dc97e3 100644 --- a/wezterm-gui/src/termwindow/mod.rs +++ b/wezterm-gui/src/termwindow/mod.rs @@ -869,7 +869,15 @@ impl TermWindow { ) -> anyhow::Result { log::debug!("{event:?}"); match event { - WindowEvent::Destroyed => Ok(false), + WindowEvent::Destroyed => { + // Ensure that we cancel any overlays we had running, so + // that the mux can empty out, otherwise the mux keeps + // the TermWindow alive via the frontend even though + // the window is gone and we'll linger forever. + // + self.clear_all_overlays(); + Ok(false) + } WindowEvent::CloseRequested => { self.close_requested(window); Ok(true)