From d773056d2eda33c2da0ce2a9ce6d4278c0785da4 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Sun, 24 Nov 2024 20:36:18 +1000 Subject: [PATCH] touchpad: remove assert that may trigger during a race condition There appears to be a race condition where an ABS_MT_TRACKING_ID -1 event is on the wire but libevdev_fetch_slot_value() for that slot already gives us -1 as well. If we just (re)opened our device, synching our slots would thus set zero active slots and then trigger the assert when that event is being processed. It's unclear how to reliably reproduce this issue but removing the assert and simply ignoring this event if we don't have active slots is correct anyway. Closes #1050 Part-of: --- src/evdev-mt-touchpad.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 9c219a68..d92b9eb0 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -546,8 +546,7 @@ tp_process_absolute(struct tp_dispatch *tp, if (e->value != -1) { tp->nactive_slots += 1; tp_new_touch(tp, t, time); - } else { - assert(tp->nactive_slots >= 1); + } else if (tp->nactive_slots >= 1) { tp->nactive_slots -= 1; tp_end_sequence(tp, t, time); } -- 2.34.1