fix for using freed memory with modal grease pencil draw.

This commit is contained in:
Campbell Barton
2011-03-18 02:44:40 +00:00
parent faafd4634a
commit a0c8727b34

View File

@@ -1606,7 +1606,6 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
if (ELEM4(event->type, RETKEY, PADENTER, ESCKEY, SPACEKEY)) {
/* exit() ends the current stroke before cleaning up */
//printf("\t\tGP - end of paint op + end of stroke\n");
gpencil_draw_exit(C, op);
p->status= GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
}
@@ -1629,7 +1628,6 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
}
else {
//printf("\t\tGP - end of stroke + op\n");
gpencil_draw_exit(C, op);
p->status= GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
}
@@ -1642,7 +1640,6 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
*/
if (CTX_wm_area(C) != p->sa) {
//printf("\t\t\tGP - wrong area execution abort! \n");
gpencil_draw_exit(C, op);
p->status= GP_STATUS_ERROR;
estate = OPERATOR_CANCELLED;
}
@@ -1656,7 +1653,6 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
gp_paint_initstroke(p, p->paintmode);
if (p->status == GP_STATUS_ERROR) {
gpencil_draw_exit(C, op);
estate = OPERATOR_CANCELLED;
}
}
@@ -1675,7 +1671,6 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
/* finish painting operation if anything went wrong just now */
if (p->status == GP_STATUS_ERROR) {
//printf("\t\t\t\tGP - add error done! \n");
gpencil_draw_exit(C, op);
estate = OPERATOR_CANCELLED;
}
else {
@@ -1717,9 +1712,14 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
switch (estate) {
case OPERATOR_FINISHED:
/* one last flush before we're done */
gpencil_draw_exit(C, op);
WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); // XXX need a nicer one that will work
break;
case OPERATOR_CANCELLED:
gpencil_draw_exit(C, op);
break;
case OPERATOR_RUNNING_MODAL|OPERATOR_PASS_THROUGH:
/* event doesn't need to be handled */
//printf("unhandled event -> %d (mmb? = %d | mmv? = %d)\n", event->type, event->type == MIDDLEMOUSE, event->type==MOUSEMOVE);