diff options
author | Dominique Martinet <asmadeus@codewreck.org> | 2017-08-11 19:17:03 +0200 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2017-08-11 19:17:03 +0200 |
commit | 0354aaeff2b57b8e6f4ea536f78ccad605ac1327 (patch) | |
tree | 42f5e6aae34a1d00fa353e5879556cbacf4e455a /backend/libinput | |
parent | 0663b6d1e1e3041d87aae4576c2c9faf5e94793e (diff) |
Complete a few destroy functions
This adds missing free calls for:
- drm outputs
- libinput backend in general
- final udev free
- output mode state
Diffstat (limited to 'backend/libinput')
-rw-r--r-- | backend/libinput/backend.c | 14 | ||||
-rw-r--r-- | backend/libinput/events.c | 5 |
2 files changed, 18 insertions, 1 deletions
diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index 68f1752b..8c1c305d 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -78,7 +78,19 @@ static bool wlr_libinput_backend_init(struct wlr_backend_state *state) { } static void wlr_libinput_backend_destroy(struct wlr_backend_state *state) { - // TODO + if (!state) { + return; + } + + for (size_t i = 0; i < state->devices->length; i++) { + struct wlr_input_device *wlr_device = state->devices->items[i]; + + wlr_input_device_destroy(wlr_device); + } + list_free(state->devices); + libinput_unref(state->libinput); + + free(state); } static struct wlr_backend_impl backend_impl = { diff --git a/backend/libinput/events.c b/backend/libinput/events.c index 9fe81782..8a7971c8 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -24,6 +24,11 @@ struct wlr_input_device *get_appropriate_device( } static void wlr_libinput_device_destroy(struct wlr_input_device_state *state) { + list_t *devices = libinput_device_get_user_data(state->handle); + // devices themselves are freed in wlr_libinput_backend_destroy + // this list only has a part of the same elements so just free list + list_free(devices); + libinput_device_unref(state->handle); free(state); } |