Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-10-01 17:34:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-10-01 17:34:51 +0300
commit864a53e276967359714723d6c3b700ae4dfb7f8c (patch)
tree61f02d5ffeb9bf0dc83d422a2a81979b412a6446 /source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
parent9a6aba2a94dbaee818630c26232274dc2962c828 (diff)
Fix gradient tool crash with recent changes
Having gesture automatic free memory isn't practical if this has it's own allocations. Add option not to free userdata.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index 4e807ccb4ef..9483a12aa6a 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -671,15 +671,14 @@ static void gradientVertInit__mapFunc(
static int paint_weight_gradient_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
- int ret = WM_gesture_straightline_modal(C, op, event);
wmGesture *gesture = op->customdata;
DMGradient_vertStoreBase *vert_cache = gesture->userdata;
- bool do_gesture_free = false;
+ int ret = WM_gesture_straightline_modal(C, op, event);
if (ret & OPERATOR_RUNNING_MODAL) {
if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { /* XXX, hardcoded */
/* generally crap! redo! */
- do_gesture_free = true;
+ WM_gesture_straightline_cancel(C, op);
ret &= ~OPERATOR_RUNNING_MODAL;
ret |= OPERATOR_FINISHED;
}
@@ -693,16 +692,14 @@ static int paint_weight_gradient_modal(bContext *C, wmOperator *op, const wmEven
BKE_defvert_array_copy(me->dvert, vert_cache->wpp.wpaint_prev, me->totvert);
wpaint_prev_destroy(&vert_cache->wpp);
}
+ MEM_freeN(vert_cache);
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
}
else if (ret & OPERATOR_FINISHED) {
wpaint_prev_destroy(&vert_cache->wpp);
- }
-
- if (do_gesture_free) {
- WM_gesture_straightline_cancel(C, op);
+ MEM_freeN(vert_cache);
}
return ret;
@@ -733,6 +730,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op)
sizeof(DMGradient_vertStoreBase) +
(sizeof(DMGradient_vertStore) * me->totvert),
__func__);
+ gesture->userdata_free = false;
data.is_init = true;
wpaint_prev_create(&((DMGradient_vertStoreBase *)gesture->userdata)->wpp, me->dvert, me->totvert);