[PATCH weston 05/11] Clients: Don't set the cursor when we have no pointer

Kristian Høgsberg hoegsberg at gmail.com
Thu Nov 8 08:26:34 PST 2012


On Wed, Nov 07, 2012 at 05:51:39PM +1100, Daniel Stone wrote:
> Avoids a segfault whenever we get a key event, and try to set the
> cursor, dereferencing a NULL input->pointer.

Looks good, and I picked it up for 1.0 as well.

Kristian

> Signed-off-by: Daniel Stone <daniel at fooishbar.org>
> ---
>  clients/window.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/clients/window.c b/clients/window.c
> index ddd8bca..288a526 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -2613,6 +2613,9 @@ input_set_pointer_image_index(struct input *input, int index)
>  	struct wl_cursor *cursor;
>  	struct wl_cursor_image *image;
>  
> +	if (!input->pointer)
> +		return;
> +
>  	cursor = input->display->cursors[input->current_cursor];
>  	if (!cursor)
>  		return;
> @@ -2652,6 +2655,9 @@ pointer_surface_frame_callback(void *data, struct wl_callback *callback,
>  		input->cursor_frame_cb = NULL;
>  	}
>  
> +	if (!input->pointer)
> +		return;
> +
>  	if (input->current_cursor == CURSOR_BLANK) {
>  		wl_pointer_set_cursor(input->pointer,
>  				      input->pointer_enter_serial,
> -- 
> 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