From d31b5a1ccf046a87337abbdaf952ce7085baf72a Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 8 Nov 2023 10:51:14 +1000 Subject: [PATCH] eis: only queue a seat bind event if the caps change This triggered an internal bug message in test_ei_seat_bind_unbind_immediately. If a client unbinds all capabilities this triggers an EIS_SEAT_BIND with zero caps. peck would call eis_seat_remove() which calls eis_seat_drop(). That queued another EIS_EVENT_SEAT_BIND with zero capabilities, leading peck to call eis_seat_remove() again on an already removed seat. --- src/libeis-seat.c | 7 +++++-- src/libeis-seat.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libeis-seat.c b/src/libeis-seat.c index 3d2e1e9..a88d447 100644 --- a/src/libeis-seat.c +++ b/src/libeis-seat.c @@ -241,9 +241,12 @@ eis_seat_bind(struct eis_seat *seat, uint32_t caps) } caps &= seat->capabilities.c_mask; - seat->state = EIS_SEAT_STATE_BOUND; - eis_queue_seat_bind_event(seat, caps); + + uint32_t old_caps = seat->capabilities.bound; + seat->capabilities.bound = caps; + if (old_caps != caps) + eis_queue_seat_bind_event(seat, caps); } void diff --git a/src/libeis-seat.h b/src/libeis-seat.h index 8b64d57..d37718d 100644 --- a/src/libeis-seat.h +++ b/src/libeis-seat.h @@ -51,6 +51,8 @@ struct eis_seat { struct { uint32_t c_mask; /* this is the C API bitmask */ uint64_t proto_mask; /* the protocol mask */ + + uint32_t bound; /* C API bitmask */ } capabilities; struct list devices;