diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c index dc8429305..3132abfd2 100644 --- a/src/wayland/meta-wayland-pointer.c +++ b/src/wayland/meta-wayland-pointer.c @@ -121,21 +121,25 @@ meta_wayland_pointer_client_free (MetaWaylandPointerClient *pointer_client) { wl_list_remove (wl_resource_get_link (resource)); wl_list_init (wl_resource_get_link (resource)); + wl_resource_set_user_data (resource, NULL); } wl_resource_for_each_safe (resource, next, &pointer_client->swipe_gesture_resources) { wl_list_remove (wl_resource_get_link (resource)); wl_list_init (wl_resource_get_link (resource)); + wl_resource_set_user_data (resource, NULL); } wl_resource_for_each_safe (resource, next, &pointer_client->pinch_gesture_resources) { wl_list_remove (wl_resource_get_link (resource)); wl_list_init (wl_resource_get_link (resource)); + wl_resource_set_user_data (resource, NULL); } wl_resource_for_each_safe (resource, next, &pointer_client->relative_pointer_resources) { wl_list_remove (wl_resource_get_link (resource)); wl_list_init (wl_resource_get_link (resource)); + wl_resource_set_user_data (resource, NULL); } g_free (pointer_client); @@ -200,6 +204,10 @@ meta_wayland_pointer_unbind_pointer_client_resource (struct wl_resource *resourc MetaWaylandPointerClient *pointer_client; struct wl_client *client = wl_resource_get_client (resource); + pointer = wl_resource_get_user_data (resource); + if (!pointer) + return; + wl_list_remove (wl_resource_get_link (resource)); pointer_client = meta_wayland_pointer_get_pointer_client (pointer, client); @@ -1105,9 +1113,13 @@ pointer_set_cursor (struct wl_client *client, struct wl_resource *surface_resource, int32_t hot_x, int32_t hot_y) { - MetaWaylandPointer *pointer = wl_resource_get_user_data (resource); + MetaWaylandPointer *pointer; MetaWaylandSurface *surface; + pointer = wl_resource_get_user_data (resource); + if (!pointer) + return; + surface = (surface_resource ? wl_resource_get_user_data (surface_resource) : NULL); if (pointer->focus_surface == NULL)