From 2bafd2230d1aff709cb3bbe7d0ed319ac17e36cf Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Thu, 10 Nov 2022 12:51:59 +0100 Subject: [PATCH] layer: Fix panic on destroying layer-shell surface --- src/wayland/handlers/layer_shell.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/wayland/handlers/layer_shell.rs b/src/wayland/handlers/layer_shell.rs index b6124487..2083d541 100644 --- a/src/wayland/handlers/layer_shell.rs +++ b/src/wayland/handlers/layer_shell.rs @@ -66,12 +66,14 @@ impl WlrLayerShellHandler for State { .cloned(); if let Some(output) = maybe_output { - let mut map = layer_map_for_output(&output); - let layer = map - .layer_for_surface(surface.wl_surface(), WindowSurfaceType::TOPLEVEL) - .unwrap() - .clone(); - map.unmap_layer(&layer); + { + let mut map = layer_map_for_output(&output); + let layer = map + .layer_for_surface(surface.wl_surface(), WindowSurfaceType::TOPLEVEL) + .unwrap() + .clone(); + map.unmap_layer(&layer); + } // collect screencopy sessions needing an update let mut scheduled_sessions = self.schedule_workspace_sessions(surface.wl_surface());