aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/varray.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/varray.c')
-rw-r--r--src/mesa/main/varray.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index c9896ae3ca6..c0b7bcfabe9 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -58,7 +58,9 @@ update_array(GLcontext *ctx, struct gl_client_array *array,
array->Ptr = (const GLubyte *) ptr;
#if FEATURE_ARB_vertex_buffer_object
array->BufferObj->RefCount--;
- /* XXX free buffer object if RefCount == 0 ? */
+ if (array->BufferObj->RefCount <= 0) {
+ (*ctx->Driver.DeleteBuffer)( ctx, array->BufferObj );
+ }
array->BufferObj = ctx->Array.ArrayBufferObj;
array->BufferObj->RefCount++;
/* Compute the index of the last array element that's inside the buffer.