Cleanup some leaks/incorrect destructions

This commit is contained in:
nyorain 2017-06-20 19:01:20 +02:00
parent a96d90dec4
commit 51f35e7af0
3 changed files with 12 additions and 1 deletions

View File

@ -6,6 +6,7 @@
#include <wlr/types.h> #include <wlr/types.h>
#include "backend/wayland.h" #include "backend/wayland.h"
#include "common/log.h" #include "common/log.h"
#include "types.h"
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
@ -79,6 +80,12 @@ static void wlr_wl_backend_destroy(struct wlr_backend_state *state) {
wlr_output_destroy(state->outputs[i]); 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); wlr_egl_free(&state->egl);
free(state->outputs); free(state->outputs);
if (state->seat) wl_seat_destroy(state->seat); if (state->seat) wl_seat_destroy(state->seat);

View File

@ -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) { 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_shell_surface_destroy(output->shell_surface);
wl_surface_destroy(output->surface); wl_surface_destroy(output->surface);
free(output); free(output);

View File

@ -61,6 +61,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
} }
wlr_device->pointer = wlr_pointer_create(NULL, NULL); wlr_device->pointer = wlr_pointer_create(NULL, NULL);
list_add(state->devices, wlr_device);
wl_signal_emit(&state->backend->events.input_add, wlr_device); wl_signal_emit(&state->backend->events.input_add, wlr_device);
} }
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD)) { 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); wlr_device->keyboard = wlr_keyboard_create(NULL, NULL);
list_add(state->devices, wlr_device);
wl_signal_emit(&state->backend->events.input_add, wlr_device); wl_signal_emit(&state->backend->events.input_add, wlr_device);
} }