wayland-pointer: Fix infinite loop when leaving focus from a destroyed surface

To prevent corruption, our focus listener needs to be removed even when
the surface is destroyed. So, bailing out when pointer->focus->resource
is NULL just isn't good enough.
This commit is contained in:
Jasper St. Pierre 2014-01-31 18:18:59 -05:00
parent d5d5c2167a
commit 10fead9ba1

View File

@ -322,12 +322,16 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
return; return;
resource = pointer->focus_resource; resource = pointer->focus_resource;
if (resource && pointer->focus->resource) if (resource)
{
if (pointer->focus->resource)
{ {
struct wl_client *client = wl_resource_get_client (resource); struct wl_client *client = wl_resource_get_client (resource);
struct wl_display *display = wl_client_get_display (client); struct wl_display *display = wl_client_get_display (client);
serial = wl_display_next_serial (display); serial = wl_display_next_serial (display);
wl_pointer_send_leave (resource, serial, pointer->focus->resource); wl_pointer_send_leave (resource, serial, pointer->focus->resource);
}
wl_list_remove (&pointer->focus_listener.link); wl_list_remove (&pointer->focus_listener.link);
} }