wayland/xdg-shell: Check popup parent type when assigning

We only allow mapping popups on top of surfaces with a xdg_surface
based role. Add a check and fail clients that doesn't follow this rule.

https://bugzilla.gnome.org/show_bug.cgi?id=790358
This commit is contained in:
Jonas Ådahl 2017-11-15 16:03:36 +08:00
parent 5d3b4f0134
commit c533a06e93

View File

@ -1553,6 +1553,14 @@ xdg_surface_constructor_get_popup (struct wl_client *client,
return;
}
if (!META_IS_WAYLAND_XDG_SURFACE (parent_surface->role))
{
wl_resource_post_error (xdg_shell_resource,
ZXDG_SHELL_V6_ERROR_INVALID_POPUP_PARENT,
"Invalid popup parent role");
return;
}
xdg_popup = META_WAYLAND_XDG_POPUP (surface->role);
xdg_popup->resource = wl_resource_create (client,
&zxdg_popup_v6_interface,