bufmgr_fake: Keep the bufmgr lock held while freeing a block.
authorEric Anholt <eric@anholt.net>
Thu, 5 Jul 2007 22:45:49 +0000 (15:45 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 5 Jul 2007 22:45:49 +0000 (15:45 -0700)
src/mesa/drivers/dri/common/dri_bufmgr_fake.c

index e08b5b3c7fb8433f246b7862c1c030df2d9450e1..003ac49f3b411be0250c1918273da400d2eb6425 100644 (file)
@@ -632,11 +632,11 @@ dri_fake_bo_unreference(dri_bo *bo)
 
    _glthread_LOCK_MUTEX(bufmgr_fake->mutex);
    if (--bo_fake->refcount == 0) {
-      _glthread_UNLOCK_MUTEX(bufmgr_fake->mutex);
       /* No remaining references, so free it */
       if (bo_fake->block)
         free_block(bufmgr_fake, bo_fake->block);
       free_backing_store(bo);
+      _glthread_UNLOCK_MUTEX(bufmgr_fake->mutex);
       free(bo);
       return;
    }