From bc5d849c9d2088b22744d40840b5663c2ea4f385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 7 Oct 2015 14:44:50 +0800 Subject: [PATCH] desktop-shell: NULL check whether a popup parent is a shell surface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit get_shell_surface(parent) may return NULL if the client passed a unassigned wl_surface or a wl_surface with a non-shell surface role (such as cursor role). https://bugs.freedesktop.org/show_bug.cgi?id=92316 Signed-off-by: Jonas Ã…dahl Tested-by: Olivier Fourdan Reviewed-by: Derek Foreman --- desktop-shell/shell.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 09ce5e18d..7f007668d 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -4279,8 +4279,9 @@ xdg_get_xdg_popup(struct wl_client *client, * top level or not. */ parent_shsurf = get_shell_surface(parent); - if (!shell_surface_is_xdg_popup(parent_shsurf) && - !shell_surface_is_xdg_surface(parent_shsurf)) { + if (!parent_shsurf || + (!shell_surface_is_xdg_popup(parent_shsurf) && + !shell_surface_is_xdg_surface(parent_shsurf))) { wl_resource_post_error(resource, XDG_SHELL_ERROR_INVALID_POPUP_PARENT, "xdg_popup parent was invalid");