diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-12-28 14:52:12 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2008-01-01 10:21:21 -0700 |
commit | 520a455f55f6c6c529dc6b725a5225793c0b4b01 (patch) | |
tree | cc8cdfa526fba52446d80c3f1c1cdeaa40c63d48 /src/mesa | |
parent | 678db26b9d2db0c76e7676b5499d8d55a5619a94 (diff) |
fix vbo display list memleak upon context destruction
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/vbo/vbo_context.c | 1 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save.c | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 60d0b76ab6..235cee2429 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -246,6 +246,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 87248e10f3..8dd87141c0 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; + } + } } |