[PATCH weston] window: Don't crash if a cursor image failed to load.

Kristian Høgsberg hoegsberg at gmail.com
Wed May 9 08:37:23 PDT 2012


On Tue, May 08, 2012 at 09:02:33PM -0700, Dima Ryazanov wrote:
> 
> Signed-off-by: Dima Ryazanov <dima at gmail.com>

Thanks, good fix.
Kristian

> ---
>  clients/window.c |   11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/clients/window.c b/clients/window.c
> index 2c59b23..72d36d3 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -687,10 +687,14 @@ create_cursors(struct display *display)
>  	display->cursor_shm_pool = shm_pool_create(display, pool_size);
>  
>  	for (i = 0; i < count; i++) {
> -		if (!images[i])
> +		cursor = &display->cursors[i];
> +
> +		if (!images[i]) {
> +			cursor->n_images = 0;
> +			cursor->images = NULL;
>  			continue;
> +		}
>  
> -		cursor = &display->cursors[i];
>  		create_cursor_from_images(display, cursor, images[i]);
>  
>  		XcursorImagesDestroy(images[i]);
> @@ -1958,6 +1962,9 @@ input_set_pointer_image(struct input *input, uint32_t time, int pointer)
>  	if (pointer == input->current_cursor)
>  		return;
>  
> +	if (display->cursors[pointer].n_images == 0)
> +		return;
> +
>  	image = &display->cursors[pointer].images[0];
>  
>  	if (!image->surface)
> -- 
> 1.7.9.5
> 
> _______________________________________________
> 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