[Bf-blender-cvs] [7c860ab9d4b] blender-v3.0-release: Fix T92499: duplicating geometry nodes modifier causes crash
Jacques Lucke
noreply at git.blender.org
Fri Oct 29 10:30:03 CEST 2021
Commit: 7c860ab9d4b54f9c394d3c2769927f55c6737b5f
Author: Jacques Lucke
Date: Fri Oct 29 10:29:38 2021 +0200
Branches: blender-v3.0-release
https://developer.blender.org/rB7c860ab9d4b54f9c394d3c2769927f55c6737b5f
Fix T92499: duplicating geometry nodes modifier causes crash
Calling `remove_unused_references` inside the `modify_geometry_sets` loop
was known to be not entirely reliable before. Now I just moved it out of
the loop which fixes the bug.
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
===================================================================
diff --git a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
index f4a127faf43..1e94a4a6a50 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
@@ -202,12 +202,15 @@ static void geo_node_instance_on_points_exec(GeoNodeExecParams params)
instances, *geometry_set.get_component_for_read<CurveComponent>(), instance, params);
geometry_set.remove(GEO_COMPONENT_TYPE_CURVE);
}
- /* Unused references may have been added above. Remove those now so that other nodes don't
- * process them needlessly. */
- /** \note: This currently expects that all originally existing instances were used. */
- instances.remove_unused_references();
});
+ /* Unused references may have been added above. Remove those now so that other nodes don't
+ * process them needlessly.
+ * This should eventually be moved into the loop above, but currently this is quite tricky
+ * because it might remove references that the loop still wants to iterate over. */
+ InstancesComponent &instances = geometry_set.get_component_for_write<InstancesComponent>();
+ instances.remove_unused_references();
+
params.set_output("Instances", std::move(geometry_set));
}
More information about the Bf-blender-cvs
mailing list