bugfix: Check for parent surface before creating popup

xdg_shell requires a parent surface in order to create a popup, so we
should check the validity of the parent resource and error out
accordingly

Summary: Signed-off-by: vivek <vivek.ellur@samsung.com>

Reviewers: devilhorns

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1388
This commit is contained in:
vivek 2014-09-02 08:34:52 -04:00 committed by Chris Michael
parent 8a10f288ad
commit 992f999301
1 changed files with 9 additions and 0 deletions

View File

@ -1324,6 +1324,15 @@ _e_xdg_shell_cb_popup_get(struct wl_client *client, struct wl_resource *resource
return;
}
/* check for the parent surface */
if (!parent_resource)
{
wl_resource_post_error(surface_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"Popup requires a parent shell surface");
return;
}
/* try to create a shell surface */
if (!(cdata->shell.surface =
wl_resource_create(client, &xdg_popup_interface, 1, id)))