From 4a52531a11fa27da36f9dbe849ecf0573f35a47b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 6 Jun 2018 12:45:14 +0200 Subject: 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. --- source/blender/blenkernel/intern/cachefile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '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); -- cgit v1.2.3