Merge pull request #926 from emersion/fix-x11-backend-memory-leaks

Fix some backend memory leaks
This commit is contained in:
Drew DeVault 2018-04-29 08:00:59 -04:00 committed by GitHub
commit a0f4903063
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 66 additions and 38 deletions

View file

@ -138,7 +138,7 @@ void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
}
void wlr_keyboard_init(struct wlr_keyboard *kb,
struct wlr_keyboard_impl *impl) {
const struct wlr_keyboard_impl *impl) {
kb->impl = impl;
wl_signal_init(&kb->events.key);
wl_signal_init(&kb->events.modifiers);
@ -154,15 +154,15 @@ void wlr_keyboard_destroy(struct wlr_keyboard *kb) {
if (kb == NULL) {
return;
}
xkb_state_unref(kb->xkb_state);
xkb_keymap_unref(kb->keymap);
close(kb->keymap_fd);
if (kb->impl && kb->impl->destroy) {
kb->impl->destroy(kb);
} else {
wl_list_remove(&kb->events.key.listener_list);
free(kb);
}
xkb_state_unref(kb->xkb_state);
xkb_keymap_unref(kb->keymap);
close(kb->keymap_fd);
free(kb);
}
void wlr_keyboard_led_update(struct wlr_keyboard *kb, uint32_t leds) {

View file

@ -5,7 +5,7 @@
#include <wlr/types/wlr_pointer.h>
void wlr_pointer_init(struct wlr_pointer *pointer,
struct wlr_pointer_impl *impl) {
const struct wlr_pointer_impl *impl) {
pointer->impl = impl;
wl_signal_init(&pointer->events.motion);
wl_signal_init(&pointer->events.motion_absolute);