diff options
-rw-r--r-- | source/blender/blenkernel/intern/cachefile.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/cachefile.c b/source/blender/blenkernel/intern/cachefile.c index feae033337d..30e9ae39b67 100644 --- a/source/blender/blenkernel/intern/cachefile.c +++ b/source/blender/blenkernel/intern/cachefile.c @@ -198,6 +198,9 @@ void BKE_cachefile_reader_open(CacheFile *cache_file, void BKE_cachefile_reader_free(CacheFile *cache_file, struct CacheReader **reader) { #ifdef WITH_ALEMBIC + /* Multiple modifiers and constraints can call this function concurrently, and + * cachefile_handle_free() can also be called at the same time. */ + BLI_spin_lock(&spin); if (*reader != NULL) { if (cache_file) { BLI_assert(cache_file->id.tag & LIB_TAG_COPIED_ON_WRITE); @@ -206,13 +209,11 @@ void BKE_cachefile_reader_free(CacheFile *cache_file, struct CacheReader **reade CacheReader_free(*reader); *reader = NULL; - /* Multiple modifiers and constraints can call this function concurrently. */ - BLI_spin_lock(&spin); if (cache_file && cache_file->handle_readers) { BLI_gset_remove(cache_file->handle_readers, reader, NULL); } - BLI_spin_unlock(&spin); } + BLI_spin_unlock(&spin); #else UNUSED_VARS(cache_file, reader); #endif |