diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2023-09-01 12:48:22 +0300 |
---|---|---|
committer | Kirill Primak <vyivel@eclair.cafe> | 2023-09-01 12:48:36 +0300 |
commit | e315068b9848d7fc920eb21340a076bb6587c1ff (patch) | |
tree | bd56280c6b47f536eafc767b8a92e6fa46bc97cd | |
parent | 2926acf60d80961597fa55ab68c3d15d7bf1980d (diff) | |
download | wlroots-e315068b9848d7fc920eb21340a076bb6587c1ff.tar.xz |
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.c | 6 |
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) { |