From db79d8307698023c5b867aa8b0c10ad5b3763e35 Mon Sep 17 00:00:00 2001 From: Keith Bowes Date: Wed, 19 Feb 2025 11:24:47 -0500 Subject: [PATCH] Fixed crash when wlr_xdg_popup doesn't have a parent --- waybox/xdg_shell.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/waybox/xdg_shell.c b/waybox/xdg_shell.c index a5570dc..3e66d13 100644 --- a/waybox/xdg_shell.c +++ b/waybox/xdg_shell.c @@ -411,12 +411,14 @@ static void handle_new_xdg_popup(struct wl_listener *listener, void *data) { * we always set the user data field of xdg_surfaces to the corresponding * scene node. */ struct wlr_xdg_popup *xdg_popup = data; - struct wlr_xdg_surface *parent = wlr_xdg_surface_try_from_wlr_surface( - xdg_popup->parent); - if (parent != NULL) { - struct wlr_scene_tree *parent_tree = parent->data; - xdg_popup->base->data = wlr_scene_xdg_surface_create( - parent_tree, xdg_popup->base); + if (xdg_popup->parent) { + struct wlr_xdg_surface *parent = wlr_xdg_surface_try_from_wlr_surface( + xdg_popup->parent); + if (parent != NULL) { + struct wlr_scene_tree *parent_tree = parent->data; + xdg_popup->base->data = wlr_scene_xdg_surface_create( + parent_tree, xdg_popup->base); + } } struct wb_popup *popup = calloc(1, sizeof(struct wb_popup));