fix renderbuffer mem leak
authorBrian <brian@yutani.localnet.net>
Tue, 6 Mar 2007 23:25:07 +0000 (16:25 -0700)
committerBrian <brian@yutani.localnet.net>
Tue, 6 Mar 2007 23:25:07 +0000 (16:25 -0700)
src/mesa/drivers/x11/xm_buffer.c

index a358ec25aec5a7d1eb9c9e9f1598e388bd8b4f50..747971a6c30c343474763dfc2fafd629ed0e17c1 100644 (file)
@@ -418,6 +418,18 @@ xmesa_delete_framebuffer(struct gl_framebuffer *fb)
       XMesaDestroyImage( b->rowimage );
    }
 
+   /* Note that XMesaBuffer renderbuffers normally have a refcount of 2
+    * (creation + binding) so we need to explicitly delete/unbind them here.
+    */
+   if (b->frontxrb) {
+      _mesa_unreference_renderbuffer((struct gl_renderbuffer **) &b->frontxrb);
+      ASSERT(b->frontxrb == NULL);
+   }
+   if (b->backxrb) {
+      _mesa_unreference_renderbuffer((struct gl_renderbuffer **) &b->backxrb);
+      ASSERT(b->backxrb == NULL);
+   }
+
    _mesa_free_framebuffer_data(fb);
    _mesa_free(fb);
 }