[Bf-blender-cvs] [cf56b8be37c] master: Fix T101166: crash when creating group input socket

Jacques Lucke noreply at git.blender.org
Sun Sep 18 21:07:42 CEST 2022


Commit: cf56b8be37c071f7d7fa22e3ab84029f4c895863
Author: Jacques Lucke
Date:   Sun Sep 18 21:06:56 2022 +0200
Branches: master
https://developer.blender.org/rBcf56b8be37c071f7d7fa22e3ab84029f4c895863

Fix T101166: crash when creating group input socket

The issue was that not all Group Input nodes were updated when
the node group interface changed.

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

M	source/blender/blenkernel/intern/node_tree_update.cc

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

diff --git a/source/blender/blenkernel/intern/node_tree_update.cc b/source/blender/blenkernel/intern/node_tree_update.cc
index b2caaa912d7..dcb6666317f 100644
--- a/source/blender/blenkernel/intern/node_tree_update.cc
+++ b/source/blender/blenkernel/intern/node_tree_update.cc
@@ -1047,6 +1047,7 @@ class NodeTreeMainUpdater {
 
   void update_individual_nodes(bNodeTree &ntree)
   {
+    Vector<bNode *> group_inout_nodes;
     LISTBASE_FOREACH (bNode *, node, &ntree.nodes) {
       nodeDeclarationEnsure(&ntree, node);
       if (this->should_update_individual_node(ntree, *node)) {
@@ -1058,6 +1059,18 @@ class NodeTreeMainUpdater {
           ntype.updatefunc(&ntree, node);
         }
       }
+      if (ELEM(node->type, NODE_GROUP_INPUT, NODE_GROUP_OUTPUT)) {
+        group_inout_nodes.append(node);
+      }
+    }
+    /* The update function of group input/output nodes may add new interface sockets. When that
+     * happens, all the input/output nodes have to be updated again. In the future it would be
+     * better to move this functionality out of the node update function into the operator that's
+     * supposed to create the new interface socket. */
+    if (ntree.runtime->changed_flag & NTREE_CHANGED_INTERFACE) {
+      for (bNode *node : group_inout_nodes) {
+        node->typeinfo->updatefunc(&ntree, node);
+      }
     }
   }



More information about the Bf-blender-cvs mailing list