summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-12-28 14:52:03 -0700
committerBrian <[email protected]>2008-01-01 10:23:56 -0700
commitf9b696be2b62689d6439a3bea116e3e1b03467d6 (patch)
tree5f2e1853a5546e778b4541d5f62ed74f385d2fb5 /src/mesa/vbo
parentc923edbc71046fbf3f8e478bbb7df33224ced3f6 (diff)
fix vbo display list memleak upon context destruction
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r--src/mesa/vbo/vbo_context.c1
-rw-r--r--src/mesa/vbo/vbo_save.c15
2 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index f64f59d11ec..f128ae6341c 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -242,6 +242,7 @@ void _vbo_DestroyContext( GLcontext *ctx )
}
vbo_exec_destroy(ctx);
+ vbo_save_destroy(ctx);
FREE(vbo_context(ctx));
ctx->swtnl_im = NULL;
}
diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c
index e7f46879639..38d9d3f8f4f 100644
--- a/src/mesa/vbo/vbo_save.c
+++ b/src/mesa/vbo/vbo_save.c
@@ -69,6 +69,21 @@ void vbo_save_init( GLcontext *ctx )
void vbo_save_destroy( GLcontext *ctx )
{
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct vbo_save_context *save = &vbo->save;
+ if (save->prim_store) {
+ if ( --save->prim_store->refcount == 0 ) {
+ FREE( save->prim_store );
+ save->prim_store = NULL;
+ }
+ if ( --save->vertex_store->refcount == 0 ) {
+ if (save->vertex_store->bufferobj)
+ ctx->Driver.DeleteBuffer( ctx, save->vertex_store->bufferobj );
+
+ FREE( save->vertex_store );
+ save->vertex_store = NULL;
+ }
+ }
}