From cede41d1902e761d4a75804375b9f6911db5cfa9 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 29 Apr 2022 10:51:56 +1000 Subject: [PATCH] Only send touch up events on destroy if the touch is down Otherwise we trig a bug error message every time we unref the touch. --- src/libei-device.c | 3 ++- src/libeis-device.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libei-device.c b/src/libei-device.c index d3a177a..7142ed3 100644 --- a/src/libei-device.c +++ b/src/libei-device.c @@ -572,7 +572,8 @@ OBJECT_IMPLEMENT_SETTER(ei_touch, user_data, void *); static void ei_touch_destroy(struct ei_touch *touch) { - ei_touch_up(touch); + if (touch->state == TOUCH_IS_DOWN) + ei_touch_up(touch); ei_device_unref(touch->device); } diff --git a/src/libeis-device.c b/src/libeis-device.c index 6599bbb..5ea4399 100644 --- a/src/libeis-device.c +++ b/src/libeis-device.c @@ -529,7 +529,8 @@ OBJECT_IMPLEMENT_SETTER(eis_touch, user_data, void *); static void eis_touch_destroy(struct eis_touch *touch) { - eis_touch_up(touch); + if (touch->state == TOUCH_IS_DOWN) + eis_touch_up(touch); eis_device_unref(touch->device); }