summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-06-17 08:05:54 -0600
committerBrian Paul <brianp@vmware.com>2009-06-17 08:05:54 -0600
commite0b13e15f1fb3b64297a9110fa5f867c7455681f (patch)
tree407b28d76a124491485d079fc70dca1a733d7d50
parent420c74b870eeb87457a993c4b5034efa4b36857f (diff)
GLX: attempt to fix glean makeCurrent test cases.
Two parts to this: One we don't keep pointers to possibly freed memory anymore once we unbind the drawables from the context. Brian I need to figure out what the comment you made there, can we get a glean/piglit test so we can fix it properly? If the new gc is the same as the oldGC, we call the unbind even though we just bound it in that function. doh. (cherry picked from master, commit 77506dac8e81e9548a7e9680ce367175fe5747af)
-rw-r--r--src/glx/x11/glxcurrent.c2
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/glx/x11/glxcurrent.c b/src/glx/x11/glxcurrent.c
index 4d0a7c65eba..5434d3395f9 100644
--- a/src/glx/x11/glxcurrent.c
+++ b/src/glx/x11/glxcurrent.c
@@ -429,7 +429,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
&dummy_reply);
}
#ifdef GLX_DIRECT_RENDERING
- else if (oldGC->driContext) {
+ else if (oldGC->driContext && oldGC != gc) {
oldGC->driContext->unbindContext(oldGC->driContext);
}
#endif
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index ae790554055..80c7aafaef7 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -119,6 +119,9 @@ static int driUnbindContext(__DRIcontext *pcp)
pdp = pcp->driDrawablePriv;
prp = pcp->driReadablePriv;
+ /* already unbound */
+ if (!pdp && !prp)
+ return GL_TRUE;
/* Let driver unbind drawable from context */
(*psp->DriverAPI.UnbindContext)(pcp);
@@ -143,9 +146,10 @@ static int driUnbindContext(__DRIcontext *pcp)
* window we can determine the last context bound to the window and
* use that context's lock. (BrianP, 2-Dec-2000)
*/
+ pcp->driDrawablePriv = pcp->driReadablePriv = NULL;
+
#if 0
/* Unbind the drawable */
- pcp->driDrawablePriv = NULL;
pdp->driContextPriv = &psp->dummyContextPriv;
#endif