summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-03-06 09:49:15 -0700
committerBrian <brian@yutani.localnet.net>2007-03-06 09:49:15 -0700
commit593802c0b0f451299ac2598c6de61e884fb44830 (patch)
treefec9b99af382cd3c2d20c7641be29e91f9bb71a6 /src/mesa
parent330d7e2080ec3f4385f83a6b68e4b46f28aee7a8 (diff)
Take care of texObj reference in _mesa_free_framebuffer_data()
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/framebuffer.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 3fe70f449c..dabc96d91d 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 */