fix for crash undoing grease pencil session, last action would free entire frame which the session held a reference to.

This commit is contained in:
Campbell Barton
2011-08-09 21:32:46 +00:00
parent 3ddbc3869d
commit a10e00dc57

View File

@@ -1728,7 +1728,12 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
/* just delete last stroke, which will look like undo to the end user */
//printf("caught attempted undo event... deleting last stroke \n");
gpencil_frame_delete_laststroke(p->gpl, p->gpf);
/* undoing the last line can free p->gpf
* note, could do this in a bit more of an elegant way then a search but it at least prevents a crash */
if(BLI_findindex(&p->gpl->frames, p->gpf) == -1) {
p->gpf= NULL;
}
/* event handled, so force refresh */
ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */
estate = OPERATOR_RUNNING_MODAL;