[PATCH weston 14/17] desktop-shell: Don't call wl_list_init() in the middle of a list

Derek Foreman derekf at osg.samsung.com
Wed Jul 15 11:00:45 PDT 2015


seat->keyboard_focus_listener.link isn't a head, it's just sometimes a
member of the focus signal list.  Calling wl_list_init() on it puts
a loop in the list.

Instead, we remove the item then init it.  That way we can call remove on
it again later even if it hasn't been re-added to a list.

Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 desktop-shell/shell.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 5e34ddd..d0dda84 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -3109,6 +3109,7 @@ shell_seat_caps_changed(struct wl_listener *listener, void *data)
 		wl_signal_add(&seat->seat->keyboard->focus_signal,
 			      &seat->keyboard_focus_listener);
 	} else if (!seat->seat->keyboard) {
+		wl_list_remove(&seat->keyboard_focus_listener.link);
 		wl_list_init(&seat->keyboard_focus_listener.link);
 	}
 
@@ -3117,6 +3118,7 @@ shell_seat_caps_changed(struct wl_listener *listener, void *data)
 		wl_signal_add(&seat->seat->pointer->focus_signal,
 			      &seat->pointer_focus_listener);
 	} else if (!seat->seat->pointer) {
+		wl_list_remove(&seat->pointer_focus_listener.link);
 		wl_list_init(&seat->pointer_focus_listener.link);
 	}
 }
-- 
2.1.4



More information about the wayland-devel mailing list