[Bf-blender-cvs] [6295bdfd38d] blender-v3.4-release: Fix T102340: crash when adding image file in node group

Jacques Lucke noreply at git.blender.org
Thu Nov 10 15:53:30 CET 2022


Commit: 6295bdfd38d3a4be8ee34ea6648473b4bbddf504
Author: Jacques Lucke
Date:   Thu Nov 10 15:50:46 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB6295bdfd38d3a4be8ee34ea6648473b4bbddf504

Fix T102340: crash when adding image file in node group

The crash happened because the geometry nodes modifier is evaluated
before the node tree has been preprocessed. While there was a transitive
but non-flushing relation between these two depsgraph nodes.

However the relation between the modifier and the `ntree_output` depsgraph
node was ignored, because it had `DEPSOP_FLAG_NEEDS_UPDATE` *not* set
(which is actually correct, because not all node tree changes change its output).
Because this relation is ignored (e.g. in `calculate_pending_parents_for_node`)
the transitive relation is ignored as well.

The solution in this patch is to explicitly add this transitive non-flushing relation
to make sure the modifier only runs after the node tree has been preprocessed,
even when the node tree output has not changed. An alternative fix could be
to handle all links always but skip the execution of depsgraph nodes that are not
needed. This way all links are always taken into account. This solution would
require some deeper changes though and would be much more risky.

Also fixes T102402.

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

M	source/blender/depsgraph/intern/depsgraph_build.cc

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index 6da290d6c4e..9eeb074bbaa 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -138,9 +138,14 @@ void DEG_add_node_tree_output_relation(DepsNodeHandle *node_handle,
 {
   deg::OperationKey ntree_output_key(
       &node_tree->id, deg::NodeType::NTREE_OUTPUT, deg::OperationCode::NTREE_OUTPUT);
+  deg::OperationKey ntree_preprocess_key(&node_tree->id,
+                                         deg::NodeType::NTREE_GEOMETRY_PREPROCESS,
+                                         deg::OperationCode::NTREE_GEOMETRY_PREPROCESS);
   deg::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
   deg_node_handle->builder->add_node_handle_relation(
       ntree_output_key, deg_node_handle, description);
+  deg_node_handle->builder->add_node_handle_relation(
+      ntree_preprocess_key, deg_node_handle, description, deg::RELATION_FLAG_NO_FLUSH);
 }
 
 void DEG_add_object_cache_relation(DepsNodeHandle *node_handle,



More information about the Bf-blender-cvs mailing list