diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 0a97de9..8ea08ee 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -1311,8 +1311,10 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf, if (!unbind) dri2_dpy->ref_count++; - if (old_dsurf || old_rsurf || old_ctx) - dri2_display_release(disp); + if (old_ctx) { + EGLDisplay old_disp = _eglGetDisplayHandle(old_ctx->Resource.Display); + dri2_display_release(old_disp); + } return EGL_TRUE; } else {