gallium: fix refcount bug introduced in eb20e2984
authorKeith Whitwell <keith@tungstengraphics.com>
Fri, 12 Dec 2008 18:34:49 +0000 (18:34 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Fri, 12 Dec 2008 18:34:49 +0000 (18:34 +0000)
src/mesa/state_tracker/st_draw.c

index 3229e93248468abd00e85462da8c03db38ecd37d..e78d98f1e913e81528565c7e9fcfbb54dcc63010 100644 (file)
@@ -670,12 +670,13 @@ st_draw_vbo(GLcontext *ctx,
    }
 
    /* unreference buffers (frees wrapped user-space buffer objects) */
+   for (attr = 0; attr < num_vbuffers; attr++) {
+      pipe_buffer_reference(pipe->screen, &vbuffer[attr].buffer, NULL);
+      assert(!vbuffer[attr].buffer);
+   }
+
    if (userSpace) 
    {
-      for (attr = 0; attr < num_vbuffers; attr++) {
-         pipe_buffer_reference(pipe->screen, &vbuffer[attr].buffer, NULL);
-         assert(!vbuffer[attr].buffer);
-      }
       pipe->set_vertex_buffers(pipe, 0, NULL);
    }
 }