mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
wlr_keyboard_group: fix leak of wlr_keyboard_group->keys
If the underlying wlr_keyboard emits duplicated key-presses, wlr_keyboard_group->keys might not be empty even after calling wlr_keyboard_group_remove_keyboard() for all of the keyboards.
This commit is contained in:
parent
bd8454d3bc
commit
86976870bd
1 changed files with 11 additions and 2 deletions
|
|
@ -306,10 +306,19 @@ void wlr_keyboard_group_remove_keyboard(struct wlr_keyboard_group *group,
|
|||
}
|
||||
|
||||
void wlr_keyboard_group_destroy(struct wlr_keyboard_group *group) {
|
||||
struct keyboard_group_device *device, *tmp;
|
||||
wl_list_for_each_safe(device, tmp, &group->devices, link) {
|
||||
struct keyboard_group_device *device, *tmp_device;
|
||||
wl_list_for_each_safe(device, tmp_device, &group->devices, link) {
|
||||
wlr_keyboard_group_remove_keyboard(group, device->keyboard);
|
||||
}
|
||||
|
||||
// Now group->keys might not be empty if a wlr_keyboard has emitted
|
||||
// duplicated key presses
|
||||
struct keyboard_group_key *key, *tmp_key;
|
||||
wl_list_for_each_safe(key, tmp_key, &group->keys, link) {
|
||||
wl_list_remove(&key->link);
|
||||
free(key);
|
||||
}
|
||||
|
||||
wlr_keyboard_finish(&group->keyboard);
|
||||
|
||||
assert(wl_list_empty(&group->events.enter.listener_list));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue