fix for crash executing sculpt via python.
[blender-staging.git] / source / blender / editors / sculpt_paint / paint_stroke.c
index b63c2973758189fa3299663513095cf4d8b1c7b2..e7b625054175232256a5c4eb2876f67d4c950f0c 100644 (file)
@@ -896,11 +896,20 @@ int paint_stroke_exec(bContext *C, wmOperator *op)
 {
        PaintStroke *stroke = op->customdata;
 
+       /* only when executed for the first time */
+       if(stroke->stroke_started == 0) {
+               /* XXX stroke->last_mouse_position is unset, this may cause problems */
+               stroke->test_start(C, op, NULL);
+               stroke->stroke_started= 1;
+       }
+
        RNA_BEGIN(op->ptr, itemptr, "stroke") {
                stroke->update_step(C, stroke, &itemptr);
        }
        RNA_END;
 
+       stroke->done(C, stroke);
+
        MEM_freeN(stroke);
        op->customdata = NULL;