summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Preisinger <alexander.preisinger@gmail.com>2014-08-30 10:17:51 +0200
committerAlexander Preisinger <alexander.preisinger@gmail.com>2014-08-30 10:17:51 +0200
commit593e5e4a25812662478d830e1effbc1bb5f3b97e (patch)
tree10d8d4b46ea318fa5f89efc12315340a9a1bb498
parentce93ee8bd0460725f8c26657781cc52abb48384c (diff)
downloadmpv-593e5e4a25812662478d830e1effbc1bb5f3b97e.tar.bz2
mpv-593e5e4a25812662478d830e1effbc1bb5f3b97e.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;
}