diff options
author | weizhixiang <weizhixiang@uniontech.com> | 2021-05-19 21:48:34 +0900 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2021-05-24 04:42:49 +0000 |
commit | 1339dbaf3da19ffbbe1602d0fee023faedcb6981 (patch) | |
tree | c4828510a3d4c18cc424ef279344edeff72fc658 | |
parent | cce59210159e2699a4f69d4c4a601a1bbc7cecfe (diff) | |
download | libinput-1339dbaf3da19ffbbe1602d0fee023faedcb6981.tar.gz |
use more safety list_for_each_safe when remove element in traversing list
Signed-off-by: weizhixiang <weizhixiang@uniontech.com>
-rw-r--r-- | src/path-seat.c | 2 | ||||
-rw-r--r-- | src/timer.c | 2 | ||||
-rw-r--r-- | tools/libinput-debug-gui.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/path-seat.c b/src/path-seat.c index e0864314..ca60539b 100644 --- a/src/path-seat.c +++ b/src/path-seat.c @@ -414,7 +414,7 @@ libinput_path_remove_device(struct libinput_device *device) return; } - list_for_each(dev, &input->path_list, link) { + list_for_each_safe(dev, &input->path_list, link) { if (dev->udev_device == evdev->udev_device) { path_device_destroy(dev); break; diff --git a/src/timer.c b/src/timer.c index 9f90fdd5..22d7a962 100644 --- a/src/timer.c +++ b/src/timer.c @@ -136,7 +136,7 @@ libinput_timer_handler(struct libinput *libinput , uint64_t now) struct libinput_timer *timer; restart: - list_for_each(timer, &libinput->timer.list, link) { + list_for_each_safe(timer, &libinput->timer.list, link) { if (timer->expire == 0) continue; diff --git a/tools/libinput-debug-gui.c b/tools/libinput-debug-gui.c index 187567a6..0cca8870 100644 --- a/tools/libinput-debug-gui.c +++ b/tools/libinput-debug-gui.c @@ -1016,7 +1016,7 @@ unregister_evdev_device(struct window *w, struct libinput_device *dev) { struct evdev_device *d; - list_for_each(d, &w->evdev_devices, node) { + list_for_each_safe(d, &w->evdev_devices, node) { if (d->libinput_device != dev) continue; |