From c91a21d42b4a8eaa80e953a4ce7935fe7d54d545 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Thu, 31 Jul 2025 22:06:30 +0200 Subject: [PATCH] Fix: Geometry Nodes: crash when linking closure/bundle to group in/output extent socket The issue was that the parent node group was not necessarily updated already when the tracing code ran. So use socket identifiers instead of indices to try to find corresponding sockets between group nodes and their corresponding node groups. --- source/blender/nodes/intern/trace_values.cc | 30 ++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/source/blender/nodes/intern/trace_values.cc b/source/blender/nodes/intern/trace_values.cc index 7b183a038d0..566cfce1a6d 100644 --- a/source/blender/nodes/intern/trace_values.cc +++ b/source/blender/nodes/intern/trace_values.cc @@ -91,9 +91,12 @@ static Vector find_target_sockets_through_contexts( const ComputeContext &group_compute_context = compute_context_cache.for_group_node( socket.context, node->identifier, &node->owner_tree()); for (const bNode *input_node : group->group_input_nodes()) { - const bNodeSocket &group_input_socket = input_node->output_socket(socket->index()); - if (group_input_socket.is_directly_linked()) { - add_if_new({&group_compute_context, &group_input_socket}, bundle_path); + if (const bNodeSocket *group_input_socket = input_node->output_by_identifier( + socket->identifier)) + { + if (group_input_socket->is_directly_linked()) { + add_if_new({&group_compute_context, group_input_socket}, bundle_path); + } } } } @@ -107,8 +110,11 @@ static Vector find_target_sockets_through_contexts( const bNode *caller_group_node = group_context->node(); if (caller_group && caller_group_node) { caller_group->ensure_topology_cache(); - const bNodeSocket &output_socket = caller_group_node->output_socket(socket->index()); - add_if_new({group_context->parent(), &output_socket}, bundle_path); + if (const bNodeSocket *output_socket = caller_group_node->output_by_identifier( + socket->identifier)) + { + add_if_new({group_context->parent(), output_socket}, bundle_path); + } } } continue; @@ -341,8 +347,11 @@ static Vector find_origin_sockets_through_contexts( if (const bNode *group_output_node = group->group_output_node()) { const ComputeContext &group_compute_context = compute_context_cache.for_group_node( socket.context, node->identifier, &node->owner_tree()); - add_if_new({&group_compute_context, &group_output_node->input_socket(socket->index())}, - bundle_path); + if (const bNodeSocket *group_output_socket = group_output_node->input_by_identifier( + socket->identifier)) + { + add_if_new({&group_compute_context, group_output_socket}, bundle_path); + } } } continue; @@ -355,8 +364,11 @@ static Vector find_origin_sockets_through_contexts( const bNode *caller_group_node = group_context->node(); if (caller_group && caller_group_node) { caller_group->ensure_topology_cache(); - const bNodeSocket &input_socket = caller_group_node->input_socket(socket->index()); - add_if_new({group_context->parent(), &input_socket}, bundle_path); + if (const bNodeSocket *input_socket = caller_group_node->input_by_identifier( + socket->identifier)) + { + add_if_new({group_context->parent(), input_socket}, bundle_path); + } } } continue;