fix vbo display list memleak upon context destruction

This commit is contained in:
Brian 2007-12-28 14:52:12 -07:00
parent 678db26b9d
commit 520a455f55
2 changed files with 16 additions and 0 deletions

View file

@ -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;
}

View file

@ -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;
}
}
}