use wl_list_for_each_safe to iterate on the bindings list when
firing them, this way a binding can safely be destroyed in its
function handler.
---
 src/bindings.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/bindings.c b/src/bindings.c
index 7d30024..d72357c 100644
--- a/src/bindings.c
+++ b/src/bindings.c
@@ -261,7 +261,7 @@ weston_compositor_run_key_binding(struct weston_compositor 
*compositor,
                                  uint32_t time, uint32_t key,
                                  enum wl_keyboard_key_state state)
 {
-       struct weston_binding *b;
+       struct weston_binding *b, *tmp;
 
        if (state == WL_KEYBOARD_KEY_STATE_RELEASED)
                return;
@@ -270,7 +270,7 @@ weston_compositor_run_key_binding(struct weston_compositor 
*compositor,
        wl_list_for_each(b, &compositor->modifier_binding_list, link)
                b->key = key;
 
-       wl_list_for_each(b, &compositor->key_binding_list, link) {
+       wl_list_for_each_safe(b, tmp, &compositor->key_binding_list, link) {
                if (b->key == key && b->modifier == seat->modifier_state) {
                        weston_key_binding_handler_t handler = b->handler;
                        handler(seat, time, key, b->data);
-- 
2.1.2

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to