Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-10-12 23:38:56 +0300
committerHans Goudey <h.goudey@me.com>2021-10-12 23:38:56 +0300
commitf18ab3470f3da32d561781e0794e5983221d5a2d (patch)
treeaa95b5c2f55b0257f16fed9714cb8d4775df1b07 /source/blender/blenloader/intern/readfile.c
parent9d03990e32ac36a4b9c6f958e9b1bea7288b0bbc (diff)
Fix T91809: Crash on undo with empty field inferencing
Some runtime data that stores which sockets can be fields and which can't is not stored in the file, but only calculated when necessary. When opening a file, the node tree update function was called, which recalculated this data, but that was explicily turned off for undo. This exposes a fundamental issue with undo, the ID caching system for undo, and how it relates to node trees in particular. Ideally this call couldn't be necessary at all. In the future it could be removed by adding a runtime struct to node trees, and calculating its contents on-demand instead of preemtively. Differential Revision: https://developer.blender.org/D12699
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r--source/blender/blenloader/intern/readfile.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 491322e06df..a41b0641fc7 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4027,11 +4027,13 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
* does not always properly handle user counts, and/or that function does not take into
* account old, deprecated data. */
BKE_main_id_refcount_recompute(bfd->main, false);
-
- /* After all data has been read and versioned, uses LIB_TAG_NEW. */
- ntreeUpdateAllNew(bfd->main);
}
+ /* After all data has been read and versioned, uses LIB_TAG_NEW. Theoretically this should
+ * not be calculated in the undo case, but it is currently needed even on undo to recalculate
+ * a cache. */
+ ntreeUpdateAllNew(bfd->main);
+
placeholders_ensure_valid(bfd->main);
BKE_main_id_tag_all(bfd->main, LIB_TAG_NEW, false);