Fix T88394: crash when editing animated Alembic properties
When an object, whose mesh gets loaded from Alembic, gets animated in Blender and the Alembic CacheFile datablock also gets animated, editing keyframes causes both datablock to be re-copied for evaluation. This caused a threading issue and a double-free of some memory. This is fixed by expanding the scope of the spin lock in `BKE_cachefile_reader_free()`.
This commit is contained in:
parent
b8cf8e0bc2
commit
847b66e81d
Notes:
blender-bot
2023-02-14 11:28:43 +01:00
Referenced by issue #88394, Crash on edit/moving "override frame" keyframes of alembic mesh sequence cache modifier.
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue