summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
Diffstat (limited to 'video')
-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;
}