[Bf-blender-cvs] [b15e1861ac1] master: Fix T92460: crash when instancing on curves generated from string
Jacques Lucke
noreply at git.blender.org
Mon Oct 25 15:14:05 CEST 2021
Commit: b15e1861ac1d8e98af8f8d33cb4e59cf0e0d3419
Author: Jacques Lucke
Date: Mon Oct 25 15:12:50 2021 +0200
Branches: master
https://developer.blender.org/rBb15e1861ac1d8e98af8f8d33cb4e59cf0e0d3419
Fix T92460: crash when instancing on curves generated from string
Issue is that the Instance on Points node currently expects that all
instance references are used (see `remove_unused_references`).
This should be fixed at some point, but for now make sure that
the String to Curves node does not output unused references.
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc
M source/blender/nodes/geometry/nodes/node_geo_string_to_curves.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 78399fad2c0..44cad2d38d4 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
@@ -196,6 +196,7 @@ static void geo_node_instance_on_points_exec(GeoNodeExecParams params)
}
/* 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();
});
diff --git a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
index 1cb6d43f685..ac946540221 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc
@@ -271,8 +271,9 @@ static void geo_node_string_to_curves_exec(GeoNodeExecParams params)
/* Convert UTF-8 encoded string to UTF-32. */
size_t len_bytes;
size_t len_chars = BLI_strlen_utf8_ex(layout.text.c_str(), &len_bytes);
- Array<char32_t> char_codes(len_chars + 1);
- BLI_str_utf8_as_utf32(char_codes.data(), layout.text.c_str(), len_chars + 1);
+ Array<char32_t> char_codes_with_null(len_chars + 1);
+ BLI_str_utf8_as_utf32(char_codes_with_null.data(), layout.text.c_str(), len_chars + 1);
+ const Span<char32_t> char_codes = char_codes_with_null.as_span().drop_back(1);
/* Create and add instances. */
GeometrySet geometry_set_out;
More information about the Bf-blender-cvs
mailing list