From 992f99930151458673972d34c17f444c1875f44e Mon Sep 17 00:00:00 2001 From: vivek Date: Tue, 2 Sep 2014 08:34:52 -0400 Subject: [PATCH] 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 Reviewers: devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1388 --- src/modules/wl_desktop_shell/e_mod_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/modules/wl_desktop_shell/e_mod_main.c b/src/modules/wl_desktop_shell/e_mod_main.c index 2505a352c..535e5d2d9 100644 --- a/src/modules/wl_desktop_shell/e_mod_main.c +++ b/src/modules/wl_desktop_shell/e_mod_main.c @@ -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)))