summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2014-01-08 20:58:32 +0100
committerwm4 <wm4@nowhere>2014-01-15 20:50:52 +0100
commita63fab8921886a4e4dcf5df2ef21aa408fd79e10 (patch)
treeb9a12303872781675483d573e6e74b5c9ae0f53d /video
parent4ee8d8d3f9511c37a905d37bfdd287eab14ed0cc (diff)
downloadmpv-a63fab8921886a4e4dcf5df2ef21aa408fd79e10.tar.bz2
mpv-a63fab8921886a4e4dcf5df2ef21aa408fd79e10.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. Conflicts: video/out/wayland_common.c
Diffstat (limited to 'video')
-rw-r--r--video/out/gl_wayland.c5
-rw-r--r--video/out/vo_wayland.c3
-rw-r--r--video/out/wayland_common.c17
3 files changed, 23 insertions, 2 deletions
diff --git a/video/out/gl_wayland.c b/video/out/gl_wayland.c
index 2d4d24ce37..797f1648ac 100644
--- a/video/out/gl_wayland.c
+++ b/video/out/gl_wayland.c
@@ -188,11 +188,12 @@ static void releaseGlContext_wayland(MPGLContext *ctx)
struct vo_wayland_state *wl = ctx->vo->wayland;
gl->Finish();
+ eglReleaseThread();
+ wl_egl_window_destroy(wl->egl_context.egl_window);
+ eglDestroySurface(wl->egl_context.egl.dpy, wl->egl_context.egl_surface);
eglMakeCurrent(wl->egl_context.egl.dpy, NULL, NULL, EGL_NO_CONTEXT);
eglDestroyContext(wl->egl_context.egl.dpy, wl->egl_context.egl.ctx);
eglTerminate(wl->egl_context.egl.dpy);
- eglReleaseThread();
- wl_egl_window_destroy(wl->egl_context.egl_window);
wl->egl_context.egl.ctx = NULL;
}
diff --git a/video/out/vo_wayland.c b/video/out/vo_wayland.c
index 2c0d1ef798..c1094bc6a4 100644
--- a/video/out/vo_wayland.c
+++ b/video/out/vo_wayland.c
@@ -651,6 +651,9 @@ static void uninit(struct vo *vo)
for (int i = 0; i < MAX_BUFFERS; ++i)
destroy_shm_buffer(&p->buffers[i]);
+ if (p->redraw_callback)
+ wl_callback_destroy(p->redraw_callback);
+
talloc_free(p->original_image);
vo_wayland_uninit(vo);
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 9c703e3546..c553533ec2 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -659,6 +659,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);
@@ -667,6 +681,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);
@@ -697,6 +712,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);
}
@@ -748,6 +764,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);