touchpad: remove assert that may trigger during a race condition
authorPeter Hutterer <peter.hutterer@who-t.net>
Sun, 24 Nov 2024 10:36:18 +0000 (20:36 +1000)
committerMarge Bot <emma+marge@anholt.net>
Sun, 1 Dec 2024 22:44:50 +0000 (22:44 +0000)
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: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1081>

src/evdev-mt-touchpad.c

index 9c219a68d16cc9243ea80691bdbdb8ab939cd101..d92b9eb0520c374ea9816d9ce0251f90bfe02c42 100644 (file)
@@ -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);
                }