dri/nouveau: Avoid recursion in nouveau_bo_context_reset().
authorFrancisco Jerez <currojerez@riseup.net>
Fri, 29 Oct 2010 19:14:49 +0000 (21:14 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Sun, 31 Oct 2010 00:45:31 +0000 (02:45 +0200)
src/mesa/drivers/dri/nouveau/nouveau_bo_state.c

index f31772fe1d1cc6ae0508916a31502f40b4235636..7eef8c1ee81e648ac3154487d0d161dd17dd4893 100644 (file)
@@ -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