unreference old framebuffer, if needed, in _mesa_reference_framebuffer()
authorBrian <brian@yutani.localnet.net>
Tue, 6 Mar 2007 23:26:02 +0000 (16:26 -0700)
committerBrian <brian@yutani.localnet.net>
Tue, 6 Mar 2007 23:26:02 +0000 (16:26 -0700)
src/mesa/main/framebuffer.c

index c97d2f0077bfc8ef001b927705ce91ef9d8e09fd..3136a950e08440e6cfc78afa0df71a4c4e5bf0d2 100644 (file)
@@ -253,6 +253,13 @@ _mesa_reference_framebuffer(struct gl_framebuffer **ptr,
                             struct gl_framebuffer *fb)
 {
    assert(ptr);
+   if (*ptr == fb) {
+      /* no change */
+      return;
+   }
+   if (*ptr) {
+      _mesa_unreference_framebuffer(ptr);
+   }
    assert(!*ptr);
    assert(fb);
    _glthread_LOCK_MUTEX(fb->Mutex);