From 01d7e3d5a25a7cc49b38f5561d00c2ff22c43e93 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 9 Feb 2010 14:25:41 +0100 Subject: 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. --- src/mesa/main/bufferobj.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/mesa/main/bufferobj.c') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 2271550efe..dabb1386ca 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -556,6 +556,17 @@ _mesa_init_buffer_objects( GLcontext *ctx ) } +void +_mesa_free_buffer_objects( GLcontext *ctx ) +{ + _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL); + _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, NULL); + + _mesa_reference_buffer_object(ctx, &ctx->CopyReadBuffer, NULL); + _mesa_reference_buffer_object(ctx, &ctx->CopyWriteBuffer, NULL); +} + + /** * Bind the specified target to buffer for the specified context. * Called by glBindBuffer() and other functions. -- cgit v1.2.3