summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2014-08-30 10:17:51 +0200
committerAlessandro Ghedini <alessandro@ghedini.me>2014-09-01 17:13:24 +0200
commit16c3b27d0ac4ec59c399ff9f31d2abd763914400 (patch)
tree6320678dbf9e3e89cee8fcec917b5d85cec8d1f2
parentf8dc208d0cfe622a70056262654e966a00492d40 (diff)
downloadmpv-16c3b27d0ac4ec59c399ff9f31d2abd763914400.tar.bz2
mpv-16c3b27d0ac4ec59c399ff9f31d2abd763914400.tar.xz
gl_wayland: fix crash after eglInitialze failed
Only execute most of the opengl termination procedure if we actually have an egl context.
-rw-r--r--video/out/gl_wayland.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/video/out/gl_wayland.c b/video/out/gl_wayland.c
index ca98a26c63..3e54f11962 100644
--- a/video/out/gl_wayland.c
+++ b/video/out/gl_wayland.c
@@ -183,12 +183,14 @@ static void releaseGlContext_wayland(MPGLContext *ctx)
GL *gl = ctx->gl;
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);
+ if (wl->egl_context.egl.ctx) {
+ 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);
wl->egl_context.egl.ctx = NULL;
}