Clients: Don't set the cursor when we have no pointer
authorDaniel Stone <daniel@fooishbar.org>
Wed, 7 Nov 2012 06:51:39 +0000 (17:51 +1100)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 8 Nov 2012 16:31:37 +0000 (11:31 -0500)
Avoids a segfault whenever we get a key event, and try to set the
cursor, dereferencing a NULL input->pointer.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
clients/window.c

index ddd8bca..288a526 100644 (file)
@@ -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,