pointer/keyboard: Fix segfault once more

If the resource is destroyed before the surface, then we'll kill
ourselves. Why can I never seem to write these correctly...
This commit is contained in:
Jasper St. Pierre 2014-02-23 09:59:42 -05:00
parent 337c69e223
commit ff8c4b1bcf
2 changed files with 10 additions and 4 deletions

View File

@ -225,9 +225,12 @@ keyboard_handle_focus_surface_destroy (struct wl_listener *listener, void *data)
wl_list_remove (&keyboard->focus_surface_listener.link);
keyboard->focus_surface = NULL;
if (keyboard->focus_resource)
{
wl_list_remove (&keyboard->focus_resource_listener.link);
keyboard->focus_resource = NULL;
}
}
static void
keyboard_handle_focus_resource_destroy (struct wl_listener *listener, void *data)

View File

@ -63,9 +63,12 @@ pointer_handle_focus_surface_destroy (struct wl_listener *listener, void *data)
wl_list_remove (&pointer->focus_surface_listener.link);
pointer->focus_surface = NULL;
if (pointer->focus_resource)
{
wl_list_remove (&pointer->focus_resource_listener.link);
pointer->focus_resource = NULL;
}
}
static void
pointer_handle_focus_resource_destroy (struct wl_listener *listener, void *data)