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>2012-12-28 13:00:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-12-28 13:00:05 +0400
commit3f68790108e7a5ab9aa7253d495daded2a325c89 (patch)
treeebabd680ed788dc20d93c16efcac2530ecd391b2 /source/blender/editors/sculpt_paint
parent4e5d5e0d843095648e347a305c8314d302ca485a (diff)
fix for memory leak with weight painting and ensure vertex group is created before use.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 0ad7d144496..c31d40e5474 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -405,7 +405,7 @@ static void free_vpaint_prev(VPaint *vp)
static void free_wpaint_prev(VPaint *vp)
{
if (vp->wpaint_prev) {
- MEM_freeN(vp->wpaint_prev);
+ free_dverts(vp->wpaint_prev, vp->tot);
vp->wpaint_prev = NULL;
vp->tot = 0;
}
@@ -2498,7 +2498,7 @@ void PAINT_OT_weight_paint(wmOperatorType *ot)
RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
}
-static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op))
+static int weight_paint_set_exec(bContext *C, wmOperator *op)
{
struct Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
@@ -2506,6 +2506,10 @@ static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op))
Brush *brush = paint_brush(&ts->wpaint->paint);
float vgroup_weight = BKE_brush_weight_get(scene, brush);
+ if (wpaint_ensure_data(C, op) == FALSE) {
+ return OPERATOR_CANCELLED;
+ }
+
wpaint_fill(scene->toolsettings->wpaint, obact, vgroup_weight);
ED_region_tag_redraw(CTX_wm_region(C)); /* XXX - should redraw all 3D views */
return OPERATOR_FINISHED;
@@ -3217,6 +3221,10 @@ static int paint_weight_gradient_invoke(bContext *C, wmOperator *op, wmEvent *ev
{
int ret;
+ if (wpaint_ensure_data(C, op) == FALSE) {
+ return OPERATOR_CANCELLED;
+ }
+
ret = WM_gesture_straightline_invoke(C, op, event);
if (ret & OPERATOR_RUNNING_MODAL) {
struct ARegion *ar = CTX_wm_region(C);