From e06399c223686aee7c2b6f9fb2db66a5f2cffad6 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 6 Apr 2022 10:48:33 +0200 Subject: Fix badly broken caches handling during undo/redo. Original rework of caches during undo/redo (see D8183) had a very bad flaw hidden in it: using the key of a ghash as source of data. While this was effectively working then (cache pointer itself being part of the key, and said cache pointers not being cleared on file write), this is a general very bad way to do things. Now that cache pointers are more and more cleared on file write (as part of clearing runtime-data to reduce false-positives when checking if an ID has changed or not), this has to be fixed properly by: * Not storing the cache pointer itself in the IDCacheKey. * In undo context, in readfile code trying to preserve caches, store the cache pointers as values of the mapping, together with the usages counter The first change potentially affects all usages of `BKE_idtype_id_foreach_cache`, but in practice this code is only used by memfile reading code (i.e. undo) currently. Related to T97015. Reviewed By: brecht Maniphest Tasks: T97015 Differential Revision: https://developer.blender.org/D14559 --- source/blender/blenkernel/intern/sound.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source/blender/blenkernel/intern/sound.c') diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index b991805fae8..864a4f3281b 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -112,7 +112,6 @@ static void sound_foreach_cache(ID *id, IDCacheKey key = { .id_session_uuid = id->session_uuid, .offset_in_ID = offsetof(bSound, waveform), - .cache_v = sound->waveform, }; function_callback(id, &key, &sound->waveform, 0, user_data); -- cgit v1.2.3