From 593e5e4a25812662478d830e1effbc1bb5f3b97e Mon Sep 17 00:00:00 2001 From: Alexander Preisinger Date: Sat, 30 Aug 2014 10:17:51 +0200 Subject: gl_wayland: fix crash after eglInitialze failed Only execute most of the opengl termination procedure if we actually have an egl context. --- video/out/gl_wayland.c | 14 ++++++++------ 1 file 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; } -- cgit v1.2.3