mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 02:19:49 +01:00
fix memory leaks
This commit is contained in:
parent
20327d82cb
commit
c838679393
2 changed files with 7 additions and 1 deletions
|
@ -364,6 +364,7 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
|
|||
}
|
||||
|
||||
wlr_keyboard_set_keymap(device->keyboard, keymap);
|
||||
xkb_keymap_unref(keymap);
|
||||
xkb_context_unref(context);
|
||||
|
||||
int repeat_rate = (config->repeat_rate > 0) ? config->repeat_rate : 25;
|
||||
|
|
|
@ -118,7 +118,7 @@ void wlr_keyboard_destroy(struct wlr_keyboard *kb) {
|
|||
wl_list_remove(&kb->events.key.listener_list);
|
||||
}
|
||||
xkb_state_unref(kb->xkb_state);
|
||||
xkb_map_unref(kb->keymap);
|
||||
xkb_keymap_unref(kb->keymap);
|
||||
close(kb->keymap_fd);
|
||||
free(kb);
|
||||
}
|
||||
|
@ -136,6 +136,11 @@ void wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
|
|||
}
|
||||
xkb_keymap_ref(keymap);
|
||||
kb->keymap = keymap;
|
||||
|
||||
if (kb->xkb_state) {
|
||||
xkb_state_unref(kb->xkb_state);
|
||||
}
|
||||
|
||||
kb->xkb_state = xkb_state_new(kb->keymap);
|
||||
if (kb->xkb_state == NULL) {
|
||||
wlr_log(L_ERROR, "Failed to create XKB state");
|
||||
|
|
Loading…
Reference in a new issue