mesa: fix glDeleteBuffers() regression
authorBrian Paul <brianp@vmware.com>
Thu, 11 Nov 2010 22:31:28 +0000 (15:31 -0700)
committerBrian Paul <brianp@vmware.com>
Thu, 11 Nov 2010 22:31:36 +0000 (15:31 -0700)
This fixes a regression (failed assertion) from commit
c552f273f559968dfd770367e25329baccbcd0c4 which was hit if glDeleteBuffers()
was called on a buffer that was never bound.

NOTE: this is a candidate for the 7.9 branch.

src/mesa/main/bufferobj.c

index df44fbe46cf455d25a3540f5173a97a85cb5846a..4d62f54a95ae17d0eb97f20d6ebf311d42f849c4 100644 (file)
@@ -998,7 +998,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
          struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
          GLuint j;
 
-         ASSERT(bufObj->Name == ids[i]);
+         ASSERT(bufObj->Name == ids[i] || bufObj == &DummyBufferObject);
 
          if (_mesa_bufferobj_mapped(bufObj)) {
             /* if mapped, unmap it now */
@@ -1039,7 +1039,7 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
          }
 
          /* The ID is immediately freed for re-use */
-         _mesa_HashRemove(ctx->Shared->BufferObjects, bufObj->Name);
+         _mesa_HashRemove(ctx->Shared->BufferObjects, ids[i]);
          _mesa_reference_buffer_object(ctx, &bufObj, NULL);
       }
    }