diff options
author | Ben Skeggs <[email protected]> | 2008-11-10 15:53:51 +1100 |
---|---|---|
committer | Ben Skeggs <[email protected]> | 2008-11-10 15:53:51 +1100 |
commit | 32e6be6362e44609d36c2fb20a4c858f57c908fb (patch) | |
tree | 4ed99e93ef5f4a8bb51653917c911e04e42f5235 /src/gallium/auxiliary/pipebuffer/pb_buffer.h | |
parent | 92674bc8889e10e580c630cf85c106fa6eb34d7b (diff) | |
parent | 399da3a337932c6074a69ac73e711138271308eb (diff) |
Merge remote branch 'origin/gallium-0.2' into gallium-0.2
Diffstat (limited to 'src/gallium/auxiliary/pipebuffer/pb_buffer.h')
-rw-r--r-- | src/gallium/auxiliary/pipebuffer/pb_buffer.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h index 8505d333bda..19db8a6a913 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h @@ -177,12 +177,16 @@ pb_get_base_buffer( struct pb_buffer *buf, } +/** + * Don't call this directly. Use pb_reference instead. + */ static INLINE void pb_destroy(struct pb_buffer *buf) { assert(buf); if(!buf) return; + assert(buf->base.refcount == 0); buf->vtbl->destroy(buf); } @@ -193,11 +197,16 @@ static INLINE void pb_reference(struct pb_buffer **dst, struct pb_buffer *src) { - if (src) + if (src) { + assert(src->base.refcount); src->base.refcount++; + } - if (*dst && --(*dst)->base.refcount == 0) - pb_destroy( *dst ); + if (*dst) { + assert((*dst)->base.refcount); + if(--(*dst)->base.refcount == 0) + pb_destroy( *dst ); + } *dst = src; } |