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>2011-08-10 01:32:46 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-08-10 01:32:46 +0400
commita10e00dc5741794f125abfcfa3f7b445335b34dc (patch)
tree72a237ce54d956a839e312def7f9339c77ccdbb1
parent3ddbc3869d4fba5ca911117ca591826cc61adac1 (diff)
fix for crash undoing grease pencil session, last action would free entire frame which the session held a reference to.
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 93963b3f7ed..2311f4a3a64 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -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;