mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-30 07:10:08 +01:00
use more safety list_for_each_safe when remove element in traversing list
Signed-off-by: weizhixiang <weizhixiang@uniontech.com>
This commit is contained in:
parent
cce5921015
commit
1339dbaf3d
3 changed files with 3 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue