From 51f35e7af0f7f01381b702b7630763fb9354701a Mon Sep 17 00:00:00 2001 From: nyorain Date: Tue, 20 Jun 2017 19:01:20 +0200 Subject: [PATCH] Cleanup some leaks/incorrect destructions --- backend/wayland/backend.c | 7 +++++++ backend/wayland/output.c | 4 +++- backend/wayland/wl_seat.c | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index e57cfed97..9623a168b 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -6,6 +6,7 @@ #include #include "backend/wayland.h" #include "common/log.h" +#include "types.h" #include #include @@ -79,6 +80,12 @@ static void wlr_wl_backend_destroy(struct wlr_backend_state *state) { wlr_output_destroy(state->outputs[i]); } + for (size_t i = 0; state->devices && i < state->devices->length; ++i) { + wlr_input_device_destroy(state->devices->items[i]); + } + + list_free(state->devices); + wlr_egl_free(&state->egl); free(state->outputs); if (state->seat) wl_seat_destroy(state->seat); diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 3ec167bcf..32f2deae8 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -83,7 +83,9 @@ static bool wlr_wl_output_move_cursor(struct wlr_output_state *output, } static void wlr_wl_output_destroy(struct wlr_output_state *output) { - // TODO: free egl surface + if(output->frame_callback) wl_callback_destroy(output->frame_callback); + eglDestroySurface(output->backend->egl.display, output->surface); + wl_egl_window_destroy(output->egl_window); wl_shell_surface_destroy(output->shell_surface); wl_surface_destroy(output->surface); free(output); diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c index d56f7d74e..240cbbb08 100644 --- a/backend/wayland/wl_seat.c +++ b/backend/wayland/wl_seat.c @@ -61,6 +61,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, } wlr_device->pointer = wlr_pointer_create(NULL, NULL); + list_add(state->devices, wlr_device); wl_signal_emit(&state->backend->events.input_add, wlr_device); } if ((caps & WL_SEAT_CAPABILITY_KEYBOARD)) { @@ -75,6 +76,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, } wlr_device->keyboard = wlr_keyboard_create(NULL, NULL); + list_add(state->devices, wlr_device); wl_signal_emit(&state->backend->events.input_add, wlr_device); }