diff options
author | Alexander Preisinger <alexander.preisinger@gmail.com> | 2014-01-08 20:58:32 +0100 |
---|---|---|
committer | Alexander Preisinger <alexander.preisinger@gmail.com> | 2014-01-08 20:59:40 +0100 |
commit | 4b102550089294a6fb4cdf3b4e133f21f16d3922 (patch) | |
tree | 2d93cb970c52c3b7cb525a61a0f2ba6b67440e5e /video/out/wayland_common.c | |
parent | 0b1ba0bf64771167fbc31e08fb5853504390f03f (diff) | |
download | mpv-4b102550089294a6fb4cdf3b4e133f21f16d3922.tar.bz2 mpv-4b102550089294a6fb4cdf3b4e133f21f16d3922.tar.xz |
wayland: fix memory leaks
There are still some leaks from wayland-cursor stuff, but there is no way to
free the memory as user of the cursor library.
Diffstat (limited to 'video/out/wayland_common.c')
-rw-r--r-- | video/out/wayland_common.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index c3ae027713..82fe412f79 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -763,6 +763,20 @@ static bool create_display (struct vo_wayland_state *wl) static void destroy_display (struct vo_wayland_state *wl) { + struct vo_wayland_output *output; + + wl_list_for_each(output, &wl->display.output_list, link) { + if (output && output->output) { + wl_output_destroy(output->output); + output->output = NULL; + } + } + + wl_list_empty(&wl->display.output_list); + + if (wl->display.shm) + wl_shm_destroy(wl->display.shm); + if (wl->display.shell) wl_shell_destroy(wl->display.shell); @@ -771,6 +785,7 @@ static void destroy_display (struct vo_wayland_state *wl) if (wl->display.registry) wl_registry_destroy(wl->display.registry); + if (wl->display.display) { wl_display_flush(wl->display.display); wl_display_disconnect(wl->display.display); @@ -801,6 +816,7 @@ static void destroy_window (struct vo_wayland_state *wl) { if (wl->window.shell_surface) wl_shell_surface_destroy(wl->window.shell_surface); + if (wl->window.surface) wl_surface_destroy(wl->window.surface); } @@ -854,6 +870,7 @@ static void destroy_input (struct vo_wayland_state *wl) xkb_map_unref(wl->input.xkb.keymap); xkb_state_unref(wl->input.xkb.state); } + if (wl->input.xkb.context) xkb_context_unref(wl->input.xkb.context); @@ -1020,6 +1037,7 @@ static int vo_wayland_check_events (struct vo *vo) struct bstr file_list = bstr0(buffer); mp_event_drop_mime_data(vo->input_ctx, "text/uri-list", file_list); + free(buffer); break; } } |