From f1639ba9d5c807792fe5d0628caa1faf3316ca44 Mon Sep 17 00:00:00 2001 From: shua Date: Wed, 9 Nov 2022 01:01:50 -0500 Subject: check null in toplevel_from_popup managed to SEGFAULT the server by trying to create a popup without setting a parent first. Not sure if this is dwl or wlroots issue, so also opened a ticket upstream: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3811 --- client.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'client.h') diff --git a/client.h b/client.h index 49982e0..38330d5 100644 --- a/client.h +++ b/client.h @@ -304,7 +304,9 @@ toplevel_from_popup(struct wlr_xdg_popup *popup) while (1) { switch (surface->role) { case WLR_XDG_SURFACE_ROLE_POPUP: - if (wlr_surface_is_layer_surface(surface->popup->parent)) + if (!surface->popup->parent) + return NULL; + else if (wlr_surface_is_layer_surface(surface->popup->parent)) return wlr_layer_surface_v1_from_wlr_surface(surface->popup->parent)->data; else if (!wlr_surface_is_xdg_surface(surface->popup->parent)) return NULL; -- cgit v1.2.3