From 2fee694bccea2b383b6b09b58ee88a5225f722db Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 8 Feb 2024 05:01:55 -0700 Subject: [PATCH] wayland: avoid panic when closing/destroying window refs: https://github.com/wez/wezterm/issues/4983 --- window/src/os/wayland/window.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/window/src/os/wayland/window.rs b/window/src/os/wayland/window.rs index 552033631..e6cd1d4f6 100644 --- a/window/src/os/wayland/window.rs +++ b/window/src/os/wayland/window.rs @@ -997,6 +997,12 @@ impl WaylandWindowInner { } fn do_paint(&mut self) -> anyhow::Result<()> { + if self.window.is_none() { + // We're likely in the middle of closing/destroying + // the window; we've nothing to do here. + return Ok(()); + } + if self.frame_callback.is_some() { // Painting now won't be productive, so skip it but // remember that we need to be painted so that when