[PATCH weston 2/2] xwm: check whether the picked seat can be NULL

Pekka Paalanen ppaalanen at gmail.com
Tue Aug 19 06:53:40 PDT 2014


On Sun,  6 Jul 2014 11:44:58 +0800
Boyan Ding <stu_dby at 126.com> wrote:

> The seat picked in weston_wm_window_handle_moveresize can sometimes
> be NULL when it is (somehow) triggered with all buttons released.
> 
> This patch checks whether the seat is NULL to avoid NULL dereference.
> 
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=80837
> Signed-off-by: Boyan Ding <stu_dby at 126.com>
> ---
>  xwayland/window-manager.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
> index f64ef94..6e74b89 100644
> --- a/xwayland/window-manager.c
> +++ b/xwayland/window-manager.c
> @@ -1250,8 +1250,8 @@ weston_wm_window_handle_moveresize(struct weston_wm_window *window,
>  	struct weston_shell_interface *shell_interface =
>  		&wm->server->compositor->shell_interface;
>  
> -	if (seat->pointer->button_count != 1 || !window->view
> -	    || seat->pointer->focus != window->view)
> +	if (seat == NULL || seat->pointer->button_count != 1
> +	    || !window->view || seat->pointer->focus != window->view)
>  		return;
>  
>  	detail = client_message->data.data32[2];

Shouldn't hurt and I accidentally already pushed this. :-P

I was not able to reproduce the crash without the patch, and using
gnome-terminal, either.


Thanks,
pq


More information about the wayland-devel mailing list