From eae1be548dd5d36328121882106dc417ae8e02be Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 14 Dec 2022 11:08:35 -0600 Subject: [PATCH] Fix T103186: Missing anonymous attribute reference Creating the `WeakAnonymousAttributeID` doesn't increase the reference count, but destructing it does. --- source/blender/geometry/intern/mesh_split_edges.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/blender/geometry/intern/mesh_split_edges.cc b/source/blender/geometry/intern/mesh_split_edges.cc index ba00ba5a8a6..19db9cbfc03 100644 --- a/source/blender/geometry/intern/mesh_split_edges.cc +++ b/source/blender/geometry/intern/mesh_split_edges.cc @@ -79,6 +79,7 @@ static void add_new_edges(Mesh &mesh, } else { anonymous_ids.append(bke::WeakAnonymousAttributeID(&id.anonymous_id())); + BKE_anonymous_attribute_id_increment_weak(&id.anonymous_id()); } } Vector local_edge_ids; @@ -98,8 +99,8 @@ static void add_new_edges(Mesh &mesh, void *array; }; Vector dst_attributes; - for (const bke::AttributeIDRef &id : local_edge_ids) { - bke::GAttributeReader attribute = attributes.lookup(id); + for (const bke::AttributeIDRef &local_id : local_edge_ids) { + bke::GAttributeReader attribute = attributes.lookup(local_id); if (!attribute) { continue; } @@ -115,8 +116,8 @@ static void add_new_edges(Mesh &mesh, }); /* Free the original attribute as soon as possible to lower peak memory usage. */ - attributes.remove(id); - dst_attributes.append({id, type, new_data}); + attributes.remove(local_id); + dst_attributes.append({local_id, type, new_data}); } int *new_orig_indices = nullptr;