From e49a9888bfce4397a8d3a64543c99daf0f994aa2 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 25 Mar 2014 12:14:39 +1000 Subject: [PATCH] touchpad: clean up tap bits on destroy Signed-off-by: Peter Hutterer --- src/evdev-mt-touchpad-tap.c | 11 +++++++++++ src/evdev-mt-touchpad.c | 3 +++ src/evdev-mt-touchpad.h | 3 +++ 3 files changed, 17 insertions(+) diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c index 35982f73..5fa712f6 100644 --- a/src/evdev-mt-touchpad-tap.c +++ b/src/evdev-mt-touchpad-tap.c @@ -607,3 +607,14 @@ tp_init_tap(struct tp_dispatch *tp) return 0; } + +void +tp_destroy_tap(struct tp_dispatch *tp) +{ + if (tp->tap.source) { + libinput_remove_source(tp->device->base.seat->libinput, tp->tap.source); + tp->tap.source = NULL; + } + if (tp->tap.timer_fd > -1) + close(tp->tap.timer_fd); +} diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 63076bf7..bbbd8f39 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -690,6 +690,8 @@ tp_destroy(struct evdev_dispatch *dispatch) struct tp_dispatch *tp = (struct tp_dispatch*)dispatch; + tp_destroy_tap(tp); + if (tp->filter) tp->filter->interface->destroy(tp->filter); free(tp->touches); @@ -760,6 +762,7 @@ tp_init(struct tp_dispatch *tp, tp->base.interface = &tp_interface; tp->device = device; + tp->tap.timer_fd = -1; if (tp_init_slots(tp, device) != 0) return -1; diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index c30dc9e4..2bdb3295 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -155,4 +155,7 @@ tp_tap_handle_timeout(struct tp_dispatch *tp, uint32_t time); int tp_init_tap(struct tp_dispatch *tp); +void +tp_destroy_tap(struct tp_dispatch *tp); + #endif