[PATCH weston] desktop-shell: NULL check whether a popup parent is a shell surface

Derek Foreman derekf at osg.samsung.com
Wed Oct 7 09:41:29 PDT 2015


On 07/10/15 01:44 AM, Jonas Ådahl wrote:
> 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 <jadahl at gmail.com>

Looks pretty obviously correct. :)

Reviewed-by: Derek Foreman <derekf at osg.samsung.com>

> ---
>  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 09ce5e1..7f00766 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");
> 



More information about the wayland-devel mailing list