From ec5f7bdb2bb8166f2a011c8be6d7aa0a84045102 Mon Sep 17 00:00:00 2001 From: Uks2 Date: Fri, 3 Jun 2022 19:44:40 +0100 Subject: [PATCH] Fix active output segfault when view is off screen When a new view has just been created (i.e. we're running the kiwmi:on( "view", ... callback ), that window can be in a weird position, off all the existing outputs. Because the code for getting the active output asks for the output at that window's position, it can get back NULL and then segfault when trying to return wlr_output->data. Now, if there's no output at the window's position, the code just moves on to look at the cursor. --- kiwmi/desktop/desktop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kiwmi/desktop/desktop.c b/kiwmi/desktop/desktop.c index dd9dc83..14523d2 100644 --- a/kiwmi/desktop/desktop.c +++ b/kiwmi/desktop/desktop.c @@ -112,7 +112,9 @@ desktop_active_output(struct kiwmi_server *server) struct wlr_output *wlr_output = wlr_output_layout_output_at(server->desktop.output_layout, lx, ly); - return wlr_output->data; + if (wlr_output) { + return wlr_output->data; + } } // 3. cursor