From 44c79c4963c80e951a0733158250050fab55a910 Mon Sep 17 00:00:00 2001 From: Jens Peters Date: Fri, 22 Dec 2023 11:20:42 +0100 Subject: [PATCH] xwayland: Prevents usage of invalid data pointer There are situations where the data pointer of a parent is NULL. Checking for NULL first fixes e.g. a segmentation fault in CLion when opening the settings window from a popup menu. See also https://github.com/labwc/labwc/issues/1351#issuecomment-1867475324 --- src/xwayland.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xwayland.c b/src/xwayland.c index b109b1f3..0c44b7c7 100644 --- a/src/xwayland.c +++ b/src/xwayland.c @@ -543,7 +543,7 @@ init_foreign_toplevel(struct view *view) return; } struct view *parent = (struct view *)surface->parent->data; - if (!parent->toplevel.handle) { + if (!parent || !parent->toplevel.handle) { return; } wlr_foreign_toplevel_handle_v1_set_parent(view->toplevel.handle, parent->toplevel.handle); -- 2.52.0