gl_wayland: fix crash after eglInitialze failed

Only execute most of the opengl termination procedure if we actually have an
egl context.
This commit is contained in:
Alexander Preisinger 2014-08-30 10:17:51 +02:00
parent ce93ee8bd0
commit 593e5e4a25
1 changed files with 8 additions and 6 deletions

View File

@ -183,12 +183,14 @@ static void releaseGlContext_wayland(MPGLContext *ctx)
GL *gl = ctx->gl; GL *gl = ctx->gl;
struct vo_wayland_state *wl = ctx->vo->wayland; struct vo_wayland_state *wl = ctx->vo->wayland;
if (wl->egl_context.egl.ctx) {
gl->Finish(); gl->Finish();
eglReleaseThread(); eglReleaseThread();
wl_egl_window_destroy(wl->egl_context.egl_window); wl_egl_window_destroy(wl->egl_context.egl_window);
eglDestroySurface(wl->egl_context.egl.dpy, wl->egl_context.egl_surface); eglDestroySurface(wl->egl_context.egl.dpy, wl->egl_context.egl_surface);
eglMakeCurrent(wl->egl_context.egl.dpy, NULL, NULL, EGL_NO_CONTEXT); eglMakeCurrent(wl->egl_context.egl.dpy, NULL, NULL, EGL_NO_CONTEXT);
eglDestroyContext(wl->egl_context.egl.dpy, wl->egl_context.egl.ctx); eglDestroyContext(wl->egl_context.egl.dpy, wl->egl_context.egl.ctx);
}
eglTerminate(wl->egl_context.egl.dpy); eglTerminate(wl->egl_context.egl.dpy);
wl->egl_context.egl.ctx = NULL; wl->egl_context.egl.ctx = NULL;
} }