summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/common/dri_util.c
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@tungstengraphics.com>2007-07-19 16:41:14 +0200
committerRoland Scheidegger <sroland@tungstengraphics.com>2007-07-19 16:41:14 +0200
commitda21eff86be088852457cdcb725aed5337c4519d (patch)
tree27aee8949b412beab2759e9c0cf0a3e53dfc68ea /src/mesa/drivers/dri/common/dri_util.c
parent131a03631208afb1fce90292eb27115511f58257 (diff)
fix drawables not getting freed if context is made current with new drawables
Diffstat (limited to 'src/mesa/drivers/dri/common/dri_util.c')
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index dd52f7e915..d785382f39 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -120,7 +120,7 @@ static __DRIdrawable *__driFindDrawable(void *drawHash, __DRIid draw)
* Find drawables in the local hash that have been destroyed on the
* server.
*
- * \param drawHash Hash-table containing all know drawables.
+ * \param drawHash Hash-table containing all known drawables.
*/
static void __driGarbageCollectDrawables(void *drawHash)
{
@@ -235,6 +235,12 @@ static GLboolean driUnbindContext(__DRInativeDisplay *dpy, int scrn,
prp->refcount--;
}
+ /* destroy the drawables if they no longer exist on the server */
+ if ((pdp->refcount == 0) || (prp->refcount == 0)) {
+ /* probably shouldn't need the collector here,
+ as we know the affected drawables (or could there be others?) */
+ __driGarbageCollectDrawables(pdp->driScreenPriv->drawHash);
+ }
/* XXX this is disabled so that if we call SwapBuffers on an unbound
* window we can determine the last context bound to the window and