[Bf-blender-cvs] [f18ab3470f3] master: Fix T91809: Crash on undo with empty field inferencing

Hans Goudey noreply at git.blender.org
Tue Oct 12 22:39:01 CEST 2021


Commit: f18ab3470f3da32d561781e0794e5983221d5a2d
Author: Hans Goudey
Date:   Tue Oct 12 15:38:56 2021 -0500
Branches: master
https://developer.blender.org/rBf18ab3470f3da32d561781e0794e5983221d5a2d

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

===================================================================

M	source/blender/blenloader/intern/readfile.c

===================================================================

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



More information about the Bf-blender-cvs mailing list