diff --git a/gfx/context/xegl_ctx.c b/gfx/context/xegl_ctx.c index e10d162fa9..6ba6cbf7b4 100644 --- a/gfx/context/xegl_ctx.c +++ b/gfx/context/xegl_ctx.c @@ -324,7 +324,11 @@ void gfx_ctx_destroy(void) if (g_egl_dpy) { if (g_egl_ctx) + { + eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglDestroyContext(g_egl_dpy, g_egl_ctx); + } + if (g_egl_surf) eglDestroySurface(g_egl_dpy, g_egl_surf); eglTerminate(g_egl_dpy); @@ -333,9 +337,11 @@ void gfx_ctx_destroy(void) g_egl_ctx = NULL; g_egl_surf = NULL; g_egl_dpy = NULL; + g_config = 0; if (g_win) { + XUnmapWindow(g_dpy, g_win); XDestroyWindow(g_dpy, g_win); g_win = None; }