summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_context.c
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2010-02-09 14:25:41 +0100
committerMichal Krol <[email protected]>2010-02-09 14:52:52 +0100
commit01d7e3d5a25a7cc49b38f5561d00c2ff22c43e93 (patch)
treecaa96a292b385ab401544714bdb907b1d6ee478f /src/mesa/vbo/vbo_context.c
parenteeec2c3d951fed0d22e5dbf436d4a2d887e24221 (diff)
mesa: Enable true refcounting for NullBufferObj.
This object can be shared with another context, so we cannot just delete it when the owning context is being destroyed. Ensuring that buffer objects are properly refcounted guarantees NullBufferObj is destroyed when all references to it are removed.
Diffstat (limited to 'src/mesa/vbo/vbo_context.c')
-rw-r--r--src/mesa/vbo/vbo_context.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index 75c32e0b9be..a5b0070bd3c 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -249,17 +249,25 @@ void _vbo_InvalidateState( GLcontext *ctx, GLuint new_state )
void _vbo_DestroyContext( GLcontext *ctx )
{
+ struct vbo_context *vbo = vbo_context(ctx);
+
if (ctx->aelt_context) {
_ae_destroy_context( ctx );
ctx->aelt_context = NULL;
}
- if (vbo_context(ctx)) {
+ if (vbo) {
+ GLuint i;
+
+ for (i = 0; i < VBO_ATTRIB_MAX; i++) {
+ _mesa_reference_buffer_object(ctx, &vbo->currval[i].BufferObj, NULL);
+ }
+
vbo_exec_destroy(ctx);
#if FEATURE_dlist
vbo_save_destroy(ctx);
#endif
- FREE(vbo_context(ctx));
+ FREE(vbo);
ctx->swtnl_im = NULL;
}
}