diff options
author | Jacques Lucke <jacques@blender.org> | 2021-10-25 16:12:50 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-10-25 16:12:50 +0300 |
commit | b15e1861ac1d8e98af8f8d33cb4e59cf0e0d3419 (patch) | |
tree | f45722ea07b8f8fd719768e478772c67a4f04a50 /source/blender/nodes | |
parent | bd7f1c5cce09fefbeb11bfa729dbe86dd4021c97 (diff) |
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.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc | 1 | ||||
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_string_to_curves.cc | 5 |
2 files changed, 4 insertions, 2 deletions
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; |