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>2016-02-23 16:31:46 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-02-23 16:32:52 +0300
commite8c24ee0d9262fe648f4bd8f13e1a2f1f88ae050 (patch)
tree40137e2538cc3b250c366c68cb6b7bb75d0ea0fc /source/blender/editors/sculpt_paint/paint_stroke.c
parent7a62fe316b878e152ed90c7aa26f7c67dceb4099 (diff)
Fix memory leak running project-paint from Python
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_stroke.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 31d4e6b809a..65857cccb15 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -1237,23 +1237,33 @@ int paint_stroke_exec(bContext *C, wmOperator *op)
{
PaintStroke *stroke = op->customdata;
- RNA_BEGIN (op->ptr, itemptr, "stroke")
- {
- /* only when executed for the first time */
- if (stroke->stroke_started == 0) {
- float mval[2];
- RNA_float_get_array(&itemptr, "mouse", mval);
- stroke->test_start(C, op, mval);
- stroke->stroke_started = 1;
+ /* only when executed for the first time */
+ if (stroke->stroke_started == 0) {
+ PropertyRNA *strokeprop;
+ PointerRNA firstpoint;
+ float mouse[2];
+
+ strokeprop = RNA_struct_find_property(op->ptr, "stroke");
+
+ if (RNA_property_collection_lookup_int(op->ptr, strokeprop, 0, &firstpoint)) {
+ RNA_float_get_array(&firstpoint, "mouse", mouse);
+ stroke->stroke_started = stroke->test_start(C, op, mouse);
}
+ }
- stroke->update_step(C, stroke, &itemptr);
+ if (stroke->stroke_started) {
+ RNA_BEGIN (op->ptr, itemptr, "stroke")
+ {
+ stroke->update_step(C, stroke, &itemptr);
+ }
+ RNA_END;
}
- RNA_END;
+
+ bool ok = (stroke->stroke_started != 0);
stroke_done(C, op);
- return OPERATOR_FINISHED;
+ return ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
void paint_stroke_cancel(bContext *C, wmOperator *op)