Mesa (master): dri/nouveau: Avoid recursion in nouveau_bo_context_reset().

Francisco Jerez currojerez at kemper.freedesktop.org
Sun Oct 31 01:08:47 UTC 2010


Module: Mesa
Branch: master
Commit: dbe1eae785e8a98eb3d515b572c8e5e28b234edd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbe1eae785e8a98eb3d515b572c8e5e28b234edd

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Fri Oct 29 21:14:49 2010 +0200

dri/nouveau: Avoid recursion in nouveau_bo_context_reset().

---

 src/mesa/drivers/dri/nouveau/nouveau_bo_state.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c
index f31772f..7eef8c1 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_bo_state.c
@@ -126,13 +126,13 @@ void
 nouveau_bo_context_reset(struct nouveau_bo_context *bctx)
 {
 	struct nouveau_bo_state *s = &to_nouveau_context(bctx->ctx)->bo;
-	int i;
-
-	for (i = 0; i < bctx->count; i++)
-		nouveau_bo_ref(NULL, &bctx->marker[i].bo);
+	int i, n = bctx->count;
 
-	s->count -= bctx->count;
+	s->count -= n;
 	bctx->count = 0;
+
+	for (i = 0; i < n; i++)
+		nouveau_bo_ref(NULL, &bctx->marker[i].bo);
 }
 
 GLboolean




More information about the mesa-commit mailing list