From 2c2625acd3a89ef2c4caa4094a3a51001041a524 Mon Sep 17 00:00:00 2001 From: Daniel De Graaf Date: Sun, 21 Jan 2024 09:08:52 -0500 Subject: Fix SIGSEGV on output destroy ``` Program terminated with signal SIGSEGV, Segmentation fault. 144 struct wlr_layer_surface_v1 *layer_surface = surface->layer_surface; [Current thread is 1 (Thread 0x7f1f7c5b3ac0 (LWP 2473))] (gdb) bt ``` Add a NULL check in `find_mapped_layer_by_client` like the one in `arrange_surface`. --- sway/desktop/layer_shell.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c index aca99c97..968b0cdb 100644 --- a/sway/desktop/layer_shell.c +++ b/sway/desktop/layer_shell.c @@ -140,6 +140,9 @@ static struct sway_layer_surface *find_mapped_layer_by_client( wl_list_for_each (node, &output->layers.shell_overlay->children, link) { struct sway_layer_surface *surface = scene_descriptor_try_get(node, SWAY_SCENE_DESC_LAYER_SHELL); + if (!surface) { + continue; + } struct wlr_layer_surface_v1 *layer_surface = surface->layer_surface; struct wl_resource *resource = layer_surface->resource; -- cgit v1.2.3