[Bf-blender-cvs] [6ee1db0d677] sculpt-dev: Sculpt Expand: Fix wrong expandcache ref when finishing expand

Pablo Dobarro noreply at git.blender.org
Sun Feb 14 20:02:51 CET 2021


Commit: 6ee1db0d677a372f59290e602d1d90050db7e1a1
Author: Pablo Dobarro
Date:   Sun Feb 14 18:06:43 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rB6ee1db0d677a372f59290e602d1d90050db7e1a1

Sculpt Expand: Fix wrong expandcache ref when finishing expand

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

M	source/blender/editors/sculpt_paint/sculpt_expand.c

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

diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index 02e1b13f5e5..7934891cb20 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -853,7 +853,7 @@ static void sculpt_expand_falloff_factors_from_vertex_and_symm_create(
   }
 }
 
-static void sculpt_expand_cache_free(ExpandCache *expand_cache)
+static void sculpt_expand_cache_data_free(ExpandCache *expand_cache)
 {
   if (expand_cache->snap_enabled_face_sets) {
     BLI_gset_free(expand_cache->snap_enabled_face_sets, NULL);
@@ -868,6 +868,12 @@ static void sculpt_expand_cache_free(ExpandCache *expand_cache)
   MEM_SAFE_FREE(expand_cache);
 }
 
+static void sculpt_expand_cache_free(SculptSession *ss) {
+    sculpt_expand_cache_data_free(ss->expand_cache);
+    ss->expand_cache = NULL;
+}
+
+
 static void sculpt_expand_restore_face_set_data(SculptSession *ss, ExpandCache *expand_cache)
 {
   PBVHNode **nodes;
@@ -954,7 +960,7 @@ static void sculpt_expand_cancel(bContext *C, wmOperator *UNUSED(op))
   sculpt_expand_restore_original_state(C, ob, ss->expand_cache);
 
   SCULPT_undo_push_end();
-  sculpt_expand_cache_free(ss->expand_cache);
+  sculpt_expand_cache_free(ss);
 }
 
 static void sculpt_expand_mask_update_task_cb(void *__restrict userdata,
@@ -1265,7 +1271,7 @@ static void sculpt_expand_finish(bContext *C)
       break;
   }
 
-  sculpt_expand_cache_free(ss->expand_cache);
+  sculpt_expand_cache_free(ss);
   ED_workspace_status_text(C, NULL);
 }



More information about the Bf-blender-cvs mailing list