From: Brian Date: Tue, 6 Mar 2007 16:49:15 +0000 (-0700) Subject: Take care of texObj reference in _mesa_free_framebuffer_data() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=593802c0b0f451299ac2598c6de61e884fb44830;p=mesa.git Take care of texObj reference in _mesa_free_framebuffer_data() --- diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 3fe70f449c2..dabc96d91d9 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -223,16 +223,21 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb) for (i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; if (att->Renderbuffer) { - struct gl_renderbuffer *rb = att->Renderbuffer; - /* remove framebuffer's reference to renderbuffer */ - _mesa_dereference_renderbuffer(&rb); - if (rb && rb->Name == 0) { - /* delete window system renderbuffer */ - _mesa_dereference_renderbuffer(&rb); + _mesa_dereference_renderbuffer(&att->Renderbuffer); + } + if (att->Texture) { + /* render to texture */ + att->Texture->RefCount--; + if (att->Texture->RefCount == 0) { + GET_CURRENT_CONTEXT(ctx); + if (ctx) { + ctx->Driver.DeleteTexture(ctx, att->Texture); + } } } att->Type = GL_NONE; att->Renderbuffer = NULL; + att->Texture = NULL; } /* unbind depth/stencil to decr ref counts */