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.
This commit is contained in:
2018-06-06 12:45:14 +02:00
parent 4c4fa3d49b
commit 4a52531a11

View File

@@ -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);