[PATCH weston] shell: Make sure we actually have a resource in end_busy_cursor

Bryce Harrington bryce at osg.samsung.com
Mon Sep 14 11:32:44 PDT 2015


On Fri, Sep 11, 2015 at 02:30:39PM -0500, Derek Foreman wrote:
> It's actually possible to get here after the surface has been destroyed,
> especially when running client apps under valgrind.
> 
> That probably shouldn't be able to segfault the compositor.
> 
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>

According to the comment in shell_surface_is_wl_shell_surface(), NULL is
a valid state for this parameter.  It suggests that it will be NULL when
the shell surface is created from xwayland.

Several other places in shell.c check the state of this parameter before
use, and so adding a check here seems correct.  (In fact, I wonder if
every place in shell.c that uses shsurf->resource should check for NULL
first as well?  I'll follow up with a patch proposal.)

Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>


> ---
>  desktop-shell/shell.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
> index 034d39b..ecc42c5 100644
> --- a/desktop-shell/shell.c
> +++ b/desktop-shell/shell.c
> @@ -2119,6 +2119,7 @@ end_busy_cursor(struct weston_compositor *compositor, struct wl_client *client)
>  
>  		grab = (struct shell_grab *) pointer->grab;
>  		if (grab->grab.interface == &busy_cursor_grab_interface &&
> +		    grab->shsurf->resource &&
>  		    wl_resource_get_client(grab->shsurf->resource) == client) {
>  			shell_grab_end(grab);
>  			free(grab);
> -- 
> 2.5.1
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list