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