Mesa (mesa_7_7_branch): mesa: Ensure object refcount is null when destroying the buffer.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Feb 1 21:42:34 UTC 2010


Module: Mesa
Branch: mesa_7_7_branch
Commit: b90b3667a10f64a39e866dd528b0885511fc719e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b90b3667a10f64a39e866dd528b0885511fc719e

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Feb  1 21:33:04 2010 +0000

mesa: Ensure object refcount is null when destroying the buffer.

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 |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index 0102d8a..750fa5b 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -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);
 




More information about the mesa-commit mailing list