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:
Sybren A. Stüvel 2018-06-06 12:45:14 +02:00
parent 4c4fa3d49b
commit 4a52531a11
Notes: blender-bot 2023-02-14 05:46:40 +01:00
Referenced by issue #55352, Material view - Scene Lights don't update
1 changed files with 3 additions and 1 deletions

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