mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-03 13:30:27 +01:00
touchpad: fix leak when the touchpad is removed before the dwt keyboard
If a touchpad is removed before its dwt-paired keyboard, we're leaking the keyboard struct. Fix this by cleaning up properly when our device is removed. This is the cause of many failed tests in the udev backend tests during the CI valgrind run. Because we're testing the udev backend it will add any devices created by tests run in parallel, some of which are keyboard devices. Depening on the test completions, the keyboards may or may not get removed before this device. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
ca0c2470d7
commit
6c869071fb
2 changed files with 24 additions and 0 deletions
|
|
@ -1999,9 +1999,15 @@ static void
|
|||
tp_interface_remove(struct evdev_dispatch *dispatch)
|
||||
{
|
||||
struct tp_dispatch *tp = tp_dispatch(dispatch);
|
||||
struct evdev_paired_keyboard *kbd;
|
||||
|
||||
libinput_timer_cancel(&tp->arbitration.arbitration_timer);
|
||||
|
||||
list_for_each_safe(kbd, &tp->dwt.paired_keyboard_list, link) {
|
||||
evdev_paired_keyboard_destroy(kbd);
|
||||
}
|
||||
tp->dwt.keyboard_active = false;
|
||||
|
||||
tp_remove_tap(tp);
|
||||
tp_remove_buttons(tp);
|
||||
tp_remove_sendevents(tp);
|
||||
|
|
|
|||
|
|
@ -5119,6 +5119,23 @@ START_TEST(touchpad_dwt_multiple_keyboards)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_dwt_remove_before_keyboard)
|
||||
{
|
||||
struct litest_device *keyboard = litest_current_device();
|
||||
struct litest_device *touchpad;
|
||||
struct libinput *li = keyboard->libinput;
|
||||
|
||||
touchpad = litest_add_device(li, LITEST_SYNAPTICS_RMI4);
|
||||
ck_assert(has_disable_while_typing(touchpad));
|
||||
|
||||
libinput_dispatch(li);
|
||||
|
||||
/* remove the touchpad before the keyboard.
|
||||
* this test can fail in valgrind only */
|
||||
litest_delete_device(touchpad);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_dwt_multiple_keyboards_bothkeys)
|
||||
{
|
||||
struct litest_device *touchpad = litest_current_device();
|
||||
|
|
@ -7293,6 +7310,7 @@ TEST_COLLECTION(touchpad)
|
|||
litest_add_for_device(touchpad_dwt_multiple_keyboards_bothkeys, LITEST_SYNAPTICS_I2C);
|
||||
litest_add_for_device(touchpad_dwt_multiple_keyboards_bothkeys_modifier, LITEST_SYNAPTICS_I2C);
|
||||
litest_add_ranged_for_device(touchpad_dwt_multiple_keyboards_remove, LITEST_SYNAPTICS_I2C, &twice);
|
||||
litest_add_for_device(touchpad_dwt_remove_before_keyboard, LITEST_KEYBOARD);
|
||||
|
||||
litest_add(touchpad_thumb_lower_area_movement, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add(touchpad_thumb_lower_area_movement_rethumb, LITEST_CLICKPAD, LITEST_ANY);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue