diff options
-rw-r--r-- | backend/drm/backend.c | 1 | ||||
-rw-r--r-- | backend/libinput/backend.c | 14 | ||||
-rw-r--r-- | backend/libinput/events.c | 5 | ||||
-rw-r--r-- | backend/udev.c | 1 | ||||
-rw-r--r-- | types/wlr_output.c | 9 |
5 files changed, 27 insertions, 3 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c index a7e6824c..8427b5ee 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -36,6 +36,7 @@ static void wlr_drm_backend_destroy(struct wlr_backend_state *drm) { wlr_drm_resources_free(drm); wlr_session_close_file(drm->session, drm->fd); wl_event_source_remove(drm->drm_event); + list_free(drm->outputs); free(drm); } 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); } diff --git a/backend/udev.c b/backend/udev.c index 1cc53f60..a2492172 100644 --- a/backend/udev.c +++ b/backend/udev.c @@ -217,6 +217,7 @@ void wlr_udev_destroy(struct wlr_udev *udev) { wl_event_source_remove(udev->event); udev_monitor_unref(udev->mon); udev_unref(udev->udev); + free(udev); } bool wlr_udev_signal_add(struct wlr_udev *udev, dev_t dev, struct wl_listener *listener) { diff --git a/types/wlr_output.c b/types/wlr_output.c index 3d3acb4f..249ac5b8 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -171,10 +171,15 @@ bool wlr_output_move_cursor(struct wlr_output *output, int x, int y) { } void wlr_output_destroy(struct wlr_output *output) { - if (!output) return; + if (!output) { + return; + } + output->impl->destroy(output->state); for (size_t i = 0; output->modes && i < output->modes->length; ++i) { - free(output->modes->items[i]); + struct wlr_output_mode *mode = output->modes->items[i]; + free(mode->state); + free(mode); } list_free(output->modes); free(output); |