mesa: Ensure object refcount is null when destroying the buffer.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 1 Feb 2010 21:33:04 +0000 (21:33 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 9 Feb 2010 11:52:08 +0000 (11:52 +0000)
Lets see if this is not too pedantic. Obj pointers are never exposed to
GL apps so it should be possible to get this right.

Furthermore apps with GL widgets and test suits create and destroy many
contexts and objects, so bad reference counting is not really an option.

src/mesa/state_tracker/st_cb_bufferobjects.c

index 3ff589034ae3a587b9fa1dc338ca2df28fc02cc1..f1b4f11c05026dd482411b6cd4b41ba47928301a 100644 (file)
@@ -75,6 +75,8 @@ st_bufferobj_free(GLcontext *ctx, struct gl_buffer_object *obj)
 {
    struct st_buffer_object *st_obj = st_buffer_object(obj);
 
+   assert(obj->RefCount == 0);
+
    if (st_obj->buffer) 
       pipe_buffer_reference(&st_obj->buffer, NULL);