summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/framebuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/framebuffer.c')
-rw-r--r--src/mesa/main/framebuffer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index c97d2f0077b..3136a950e08 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -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);