Releasing a surfaceless EGL context doesn't release underlying DRI context.

driUnbindContext() checks for valid drawables before calling the driver
unbind function. In case of Surfaceless contexts, the drawables are always
Null and we end up not releasing the underlying DRI context. Moving the
call to the driver function before the drawable validity checks fixes things.

Steps to trigger this bug are following:

   - create surfaceless context and make it current
   - make some other context current
   - {another thread} destroy surfaceless context
   - make another context current

Signed-off-by: Alexandros Frantzis <Alexandros.Frantzis@canonical.com>
Signed-off-by: Kalyan Kondapally <kalyan.kondapally@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74563
This commit is contained in:
Alexandros Frantzis
2014-10-24 03:03:13 -07:00
committed by Tapani Pälli
parent cd745d46ce
commit f53b6d0134

View File

@@ -569,6 +569,12 @@ static int driUnbindContext(__DRIcontext *pcp)
if (pcp == NULL) if (pcp == NULL)
return GL_FALSE; return GL_FALSE;
/*
** Call driUnbindContext before checking for valid drawables
** to handle surfaceless contexts properly.
*/
pcp->driScreenPriv->driver->UnbindContext(pcp);
pdp = pcp->driDrawablePriv; pdp = pcp->driDrawablePriv;
prp = pcp->driReadablePriv; prp = pcp->driReadablePriv;
@@ -576,8 +582,6 @@ static int driUnbindContext(__DRIcontext *pcp)
if (!pdp && !prp) if (!pdp && !prp)
return GL_TRUE; return GL_TRUE;
pcp->driScreenPriv->driver->UnbindContext(pcp);
assert(pdp); assert(pdp);
if (pdp->refcount == 0) { if (pdp->refcount == 0) {
/* ERROR!!! */ /* ERROR!!! */