wayland: Fail when popup parent does not have an allowed role

An xdg_popup may only have another xdg_popup or xdg_surface as a parent,
so send an error if it provides an invalid parent.

https://bugzilla.gnome.org/show_bug.cgi?id=744452
This commit is contained in:
Jonas Ådahl 2015-02-10 20:58:09 +08:00
parent 945bf626c6
commit f328890ed1

View File

@ -1069,6 +1069,14 @@ xdg_shell_get_xdg_popup (struct wl_client *client,
XDG_SHELL_ERROR_ROLE) != 0)
return;
if (parent_surf->xdg_popup == NULL && parent_surf->xdg_surface == NULL)
{
wl_resource_post_error (resource,
XDG_POPUP_ERROR_INVALID_PARENT,
"invalid parent surface");
return;
}
surface->xdg_popup = wl_resource_create (client, &xdg_popup_interface, wl_resource_get_version (resource), id);
wl_resource_set_implementation (surface->xdg_popup, &meta_wayland_xdg_popup_interface, surface, xdg_popup_destructor);