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