[Bf-blender-cvs] [eae1be548dd] master: Fix T103186: Missing anonymous attribute reference

Hans Goudey noreply at git.blender.org
Wed Dec 14 18:26:52 CET 2022


Commit: eae1be548dd5d36328121882106dc417ae8e02be
Author: Hans Goudey
Date:   Wed Dec 14 11:08:35 2022 -0600
Branches: master
https://developer.blender.org/rBeae1be548dd5d36328121882106dc417ae8e02be

Fix T103186: Missing anonymous attribute reference

Creating the `WeakAnonymousAttributeID` doesn't
increase the reference count, but destructing it does.

===================================================================

M	source/blender/geometry/intern/mesh_split_edges.cc

===================================================================

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<bke::AttributeIDRef> local_edge_ids;
@@ -98,8 +99,8 @@ static void add_new_edges(Mesh &mesh,
     void *array;
   };
   Vector<NewAttributeData> 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;



More information about the Bf-blender-cvs mailing list