window: Don't crash if a cursor image failed to load.
Signed-off-by: Dima Ryazanov <dima@gmail.com>
This commit is contained in:
committed by
Kristian Høgsberg
parent
87e4c9354e
commit
ff1c2d7914
+10
-3
@@ -687,10 +687,14 @@ create_cursors(struct display *display)
|
|||||||
display->cursor_shm_pool = shm_pool_create(display, pool_size);
|
display->cursor_shm_pool = shm_pool_create(display, pool_size);
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if (!images[i])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
cursor = &display->cursors[i];
|
cursor = &display->cursors[i];
|
||||||
|
|
||||||
|
if (!images[i]) {
|
||||||
|
cursor->n_images = 0;
|
||||||
|
cursor->images = NULL;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
create_cursor_from_images(display, cursor, images[i]);
|
create_cursor_from_images(display, cursor, images[i]);
|
||||||
|
|
||||||
XcursorImagesDestroy(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)
|
if (pointer == input->current_cursor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (display->cursors[pointer].n_images == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
image = &display->cursors[pointer].images[0];
|
image = &display->cursors[pointer].images[0];
|
||||||
|
|
||||||
if (!image->surface)
|
if (!image->surface)
|
||||||
|
|||||||
Reference in New Issue
Block a user