aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2023-09-01 12:48:22 +0300
committerKirill Primak <vyivel@eclair.cafe>2023-09-01 12:48:36 +0300
commite315068b9848d7fc920eb21340a076bb6587c1ff (patch)
treebd56280c6b47f536eafc767b8a92e6fa46bc97cd
parent2926acf60d80961597fa55ab68c3d15d7bf1980d (diff)
xdg-popup: validate parent
This matches Mutter's behavior. Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3576
-rw-r--r--types/xdg_shell/wlr_xdg_popup.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c
index 99f45d59..1bb73ddc 100644
--- a/types/xdg_shell/wlr_xdg_popup.c
+++ b/types/xdg_shell/wlr_xdg_popup.c
@@ -376,6 +376,12 @@ void create_xdg_popup(struct wlr_xdg_surface *surface,
return;
}
+ if (parent != NULL && parent->role == WLR_XDG_SURFACE_ROLE_NONE) {
+ wl_resource_post_error(surface->client->resource, XDG_WM_BASE_ERROR_INVALID_POPUP_PARENT,
+ "a popup parent must have a role");
+ return;
+ }
+
assert(surface->popup == NULL);
surface->popup = calloc(1, sizeof(struct wlr_xdg_popup));
if (!surface->popup) {