From: Kristian Høgsberg Date: Sun, 13 Mar 2011 02:26:21 +0000 (-0500) Subject: Fix double remove from surface destroy_listener_list X-Git-Tag: 0.85.0~165 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d22c1bdc7720d70655d773a979e8d056be5baf1;p=profile%2Fivi%2Fwayland.git Fix double remove from surface destroy_listener_list We remove the listener when a device loses its pointer focus, but doesn't insert it in another destroy_listener list if surface is NULL. When we set another pointer focus surface, we remove it again. Tracked down and tested by Iskren Chernev. --- diff --git a/wayland/wayland-server.c b/wayland/wayland-server.c index 036958f..2316949 100644 --- a/wayland/wayland-server.c +++ b/wayland/wayland-server.c @@ -360,19 +360,21 @@ wl_input_device_set_pointer_focus(struct wl_input_device *device, &device->object, WL_INPUT_DEVICE_POINTER_FOCUS, time, NULL, 0, 0, 0, 0); - if (surface) + if (device->pointer_focus) + wl_list_remove(&device->pointer_focus_listener.link); + + if (surface) { wl_client_post_event(surface->client, &device->object, WL_INPUT_DEVICE_POINTER_FOCUS, time, surface, x, y, sx, sy); + wl_list_insert(surface->destroy_listener_list.prev, + &device->pointer_focus_listener.link); + } device->pointer_focus = surface; device->pointer_focus_time = time; - wl_list_remove(&device->pointer_focus_listener.link); - if (surface) - wl_list_insert(surface->destroy_listener_list.prev, - &device->pointer_focus_listener.link); } WL_EXPORT void @@ -389,20 +391,20 @@ wl_input_device_set_keyboard_focus(struct wl_input_device *device, &device->object, WL_INPUT_DEVICE_KEYBOARD_FOCUS, time, NULL, &device->keys); + if (device->keyboard_focus) + wl_list_remove(&device->keyboard_focus_listener.link); - if (surface) + if (surface) { wl_client_post_event(surface->client, &device->object, WL_INPUT_DEVICE_KEYBOARD_FOCUS, time, surface, &device->keys); + wl_list_insert(surface->destroy_listener_list.prev, + &device->keyboard_focus_listener.link); + } device->keyboard_focus = surface; device->keyboard_focus_time = time; - - wl_list_remove(&device->keyboard_focus_listener.link); - if (surface) - wl_list_insert(surface->destroy_listener_list.prev, - &device->keyboard_focus_listener.link); } WL_EXPORT void