diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-08-11 09:04:01 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-08-11 09:04:01 +0400 |
commit | ef18ec335ff8496d1a047615073c7258eeffa371 (patch) | |
tree | 0da45af24c4b9f4055390a9640bf0d59613605bc /source/blender/editors/gpencil | |
parent | 17e88915fdd7048365df1be48d615d69c0924b4c (diff) | |
parent | 50277c48ba5bf9eae418453159e421489895dafd (diff) |
svn merge -r39145:39286 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 28a54b20277..2311f4a3a64 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1722,13 +1722,18 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) /* standard undo/redo shouldn't be allowed to execute or else it causes crashes, so catch it here */ // FIXME: this is a hardcoded hotkey that can't be changed // TODO: catch redo as well, but how? - if (event->type == ZKEY) { + if (event->type == ZKEY && event->val == KM_RELEASE) { /* oskey = cmd key on macs as they seem to use cmd-z for undo as well? */ if ((event->ctrl) || (event->oskey)) { /* 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; |