[Bf-blender-cvs] [b40f1f4c798] sculpt-dev: Sculpt Expand: Fix multiple crashes when using modifiers
Pablo Dobarro
noreply at git.blender.org
Wed Feb 3 01:26:41 CET 2021
Commit: b40f1f4c798cc58cb57db28557026bb634c8fba8
Author: Pablo Dobarro
Date: Wed Feb 3 00:36:54 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rBb40f1f4c798cc58cb57db28557026bb634c8fba8
Sculpt Expand: Fix multiple crashes when using modifiers
===================================================================
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 4684d0045d4..461dacecb6e 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -708,9 +708,8 @@ static void sculpt_expand_falloff_factors_from_vertex_and_symm_create(
const int vertex,
eSculptExpandFalloffType falloff_type)
{
- if (expand_cache->falloff_factor) {
- MEM_freeN(expand_cache->falloff_factor);
- }
+
+ MEM_SAFE_FREE(expand_cache->falloff_factor);
switch (falloff_type) {
case SCULPT_EXPAND_FALLOFF_GEODESICS:
@@ -1257,6 +1256,15 @@ static int sculpt_expand_modal(bContext *C, wmOperator *op, const wmEvent *event
SculptSession *ss = ob->sculpt;
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
+ if (!ELEM(event->type, MOUSEMOVE, EVT_MODAL_MAP)) {
+ return OPERATOR_RUNNING_MODAL;
+ }
+
+ Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
+ BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false);
+ SCULPT_vertex_random_access_ensure(ss);
+ SCULPT_boundary_info_ensure(ob);
+
const float mouse[2] = {event->mval[0], event->mval[1]};
const int target_expand_vertex = sculpt_expand_target_vertex_update_and_get(C, ob, mouse);
@@ -1376,10 +1384,6 @@ static int sculpt_expand_modal(bContext *C, wmOperator *op, const wmEvent *event
}
}
- if (!ELEM(event->type, MOUSEMOVE, EVT_MODAL_MAP)) {
- return OPERATOR_RUNNING_MODAL;
- }
-
if (expand_cache->move) {
sculpt_expand_move_propagation_origin(C, ob, event, expand_cache);
}
More information about the Bf-blender-cvs
mailing list