[Bf-blender-cvs] [4a52531a11f] blender2.8: Alembic: Fix double-free of mutex
Sybren A. Stüvel
noreply at git.blender.org
Wed Jun 6 14:39:46 CEST 2018
Commit: 4a52531a11fa27da36f9dbe849ecf0573f35a47b
Author: Sybren A. Stüvel
Date: Wed Jun 6 12:45:14 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB4a52531a11fa27da36f9dbe849ecf0573f35a47b
Alembic: Fix double-free of mutex
The mutex was shared between CoW copies of the CacheFile datablock, and
as a result also freed multiple times. It is now only freed when the
original datablock is freed; the CoW copies share the same mutex.
===================================================================
M source/blender/blenkernel/intern/cachefile.c
===================================================================
diff --git a/source/blender/blenkernel/intern/cachefile.c b/source/blender/blenkernel/intern/cachefile.c
index 274f7b78529..89c6fad086d 100644
--- a/source/blender/blenkernel/intern/cachefile.c
+++ b/source/blender/blenkernel/intern/cachefile.c
@@ -93,7 +93,9 @@ void BKE_cachefile_free(CacheFile *cache_file)
ABC_free_handle(cache_file->handle);
#endif
- if (cache_file->handle_mutex) {
+ /* CoW copies share the mutex, so it should only be freed if the original
+ * CacheFile datablock is freed. */
+ if (cache_file->handle_mutex && (cache_file->id.tag & LIB_TAG_COPIED_ON_WRITE) == 0) {
BLI_mutex_free(cache_file->handle_mutex);
}
BLI_freelistN(&cache_file->object_paths);
More information about the Bf-blender-cvs
mailing list