From: Brian Date: Fri, 28 Dec 2007 21:51:52 +0000 (-0700) Subject: fix vbo display list memleak upon context destruction X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f0676cc4223fe05d84cee9d16f1094a7bfa181d4;p=mesa.git fix vbo display list memleak upon context destruction --- diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index 656b27f28cc..38132543501 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -240,6 +240,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 87248e10f3b..8dd87141c0c 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; + } + } }