[Bf-blender-cvs] [eedb3d06857] sculpt-dev: Sculpt-dev: fix crash in sculpt attribute API

Joseph Eagar noreply at git.blender.org
Mon Jan 17 06:25:16 CET 2022


Commit: eedb3d068576c33487da7e6166d2b1e2c0c7891e
Author: Joseph Eagar
Date:   Sun Jan 16 21:12:52 2022 -0800
Branches: sculpt-dev
https://developer.blender.org/rBeedb3d068576c33487da7e6166d2b1e2c0c7891e

Sculpt-dev: fix crash in sculpt attribute API

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

M	source/blender/blenkernel/intern/paint.c
M	source/blender/editors/sculpt_paint/sculpt_brush_types.c

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

diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index d64ce79caf6..98b31337501 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -3086,7 +3086,7 @@ static bool sculpt_attr_get_layer(SculptSession *ss,
 
     CustomData_free(&dummy, 0);
 
-    out->data = MEM_calloc_arrayN(totelem, elemsize, name);
+    out->data = MEM_calloc_arrayN(totelem, elemsize, __func__);
 
     out->is_cdlayer = false;
     out->from_bmesh = ss->bm != NULL;
diff --git a/source/blender/editors/sculpt_paint/sculpt_brush_types.c b/source/blender/editors/sculpt_paint/sculpt_brush_types.c
index d8d6efd86f7..2e1fe3af290 100644
--- a/source/blender/editors/sculpt_paint/sculpt_brush_types.c
+++ b/source/blender/editors/sculpt_paint/sculpt_brush_types.c
@@ -3486,10 +3486,6 @@ void SCULPT_do_fairing_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
 
     ss->custom_layers[SCULPT_SCL_FAIRING_MASK] = MEM_callocN(sizeof(SculptCustomLayer),
                                                              "ss->Cache->fairing_mask");
-    ss->custom_layers[SCULPT_SCL_FAIRING_FADE] = MEM_callocN(sizeof(SculptCustomLayer),
-                                                             "ss->Cache->fairing_fade");
-    ss->custom_layers[SCULPT_SCL_PREFAIRING_CO] = MEM_callocN(sizeof(SculptCustomLayer),
-                                                              "ss->Cache->prefairing_co");
 
     SculptLayerParams params = {.permanent = false, .simple_array = true};
 
@@ -3501,6 +3497,8 @@ void SCULPT_do_fairing_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
                           ss->custom_layers[SCULPT_SCL_FAIRING_MASK],
                           &params);
 
+    ss->custom_layers[SCULPT_SCL_FAIRING_FADE] = MEM_callocN(sizeof(SculptCustomLayer),
+                                                             "ss->Cache->fairing_fade");
     SCULPT_attr_get_layer(ss,
                           ob,
                           ATTR_DOMAIN_POINT,
@@ -3509,6 +3507,8 @@ void SCULPT_do_fairing_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
                           ss->custom_layers[SCULPT_SCL_FAIRING_FADE],
                           &params);
 
+    ss->custom_layers[SCULPT_SCL_PREFAIRING_CO] = MEM_callocN(sizeof(SculptCustomLayer),
+                                                              "ss->Cache->prefairing_co");
     SCULPT_attr_get_layer(ss,
                           ob,
                           ATTR_DOMAIN_POINT,



More information about the Bf-blender-cvs mailing list