[PATCH] window.c: fix SIGSEGV in pointer_handle_motion

Kristian Høgsberg hoegsberg at gmail.com
Thu Aug 29 21:19:42 PDT 2013


On Thu, Aug 29, 2013 at 10:52:54AM +0100, Paul Winwood wrote:
> moved null pointer check and assignments before first window dereference.

That looks good, applied.  I capitalized the commit title and body - that
counts as regular prose/documentation so we go for normal punctuaton there.

Kristian

> ---
>  clients/window.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/clients/window.c b/clients/window.c
> index cee436c..4f63132 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -2904,6 +2904,12 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
>  	float sx = wl_fixed_to_double(sx_w);
>  	float sy = wl_fixed_to_double(sy_w);
>  
> +	input->sx = sx;
> +	input->sy = sy;
> +
> +	if (!window)
> +		return;
> +
>  	/* when making the window smaller - e.g. after a unmaximise we might
>  	 * still have a pending motion event that the compositor has picked
>  	 * based on the old surface dimensions
> @@ -2912,12 +2918,6 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
>  	    sy > window->main_surface->allocation.height)
>  		return;
>  
> -	input->sx = sx;
> -	input->sy = sy;
> -
> -	if (!window)
> -		return;
> -
>  	if (!(input->grab && input->grab_button)) {
>  		widget = window_find_widget(window, sx, sy);
>  		input_set_focus_widget(input, widget, sx, sy);
> -- 
> 1.7.10.4
> 
> _______________________________________________
> 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