]> git.mdlowis.com Git - proto/labwc.git/commitdiff
xwayland: Prevents usage of invalid data pointer
authorJens Peters <jp7677@gmail.com>
Fri, 22 Dec 2023 10:20:42 +0000 (11:20 +0100)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Fri, 22 Dec 2023 10:24:49 +0000 (11:24 +0100)
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

index b109b1f37fe9fc6029fd0bc4ef6179eff31b10bc..0c44b7c768b89a7eb8a8509da149564f28aaa038 100644 (file)
@@ -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);