[Bf-blender-cvs] [f55f4188671] blender2.8: Fix incorrect double checked lock in collection object cache.

Brecht Van Lommel noreply at git.blender.org
Wed Jun 6 16:16:48 CEST 2018


Commit: f55f418867162994c9a0cf7ba89bed3f27a2a354
Author: Brecht Van Lommel
Date:   Wed Jun 6 12:18:41 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBf55f418867162994c9a0cf7ba89bed3f27a2a354

Fix incorrect double checked lock in collection object cache.

===================================================================

M	source/blender/blenkernel/intern/collection.c

===================================================================

diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index c4709a32f78..4651089a390 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -367,12 +367,12 @@ ListBase BKE_collection_object_cache_get(Collection *collection)
 	if (!(collection->flag & COLLECTION_HAS_OBJECT_CACHE)) {
 		static ThreadMutex cache_lock = BLI_MUTEX_INITIALIZER;
 
+		BLI_mutex_lock(&cache_lock);
 		if (!(collection->flag & COLLECTION_HAS_OBJECT_CACHE)) {
-			BLI_mutex_lock(&cache_lock);
 			collection_object_cache_fill(&collection->object_cache, collection, 0);
 			collection->flag |= COLLECTION_HAS_OBJECT_CACHE;
-			BLI_mutex_unlock(&cache_lock);
 		}
+		BLI_mutex_unlock(&cache_lock);
 	}
 
 	return collection->object_cache;



More information about the Bf-blender-cvs mailing list