Bugfix #20586: Selecting "Straight Line" from Grease Pencil crashes in UV image editor

This commit adds a check that should prevent crashes of the kind that were occurring in the report description from happening. 

However, I couldn't verify yet whether this really works, since it appears the bug has temporarily disappeared in recent svn. Just in case, I've committed this fix, and we can revert/improve if the bug returns.
This commit is contained in:
Joshua Leung 2010-02-03 11:53:57 +00:00
parent 40903efe85
commit 0cb790ac8e
1 changed files with 10 additions and 0 deletions

View File

@ -1456,6 +1456,16 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
}
else {
/* not painting, so start stroke (this should be mouse-button down) */
/* we must check that we're still within the area that we're set up to work from
* otherwise we could crash (see bug #20586)
*/
if (CTX_wm_area(C) != p->sa) {
//printf("\t\t\tGP - wrong area execution abort! \n");
gpencil_draw_exit(C, op);
return OPERATOR_CANCELLED;
}
//printf("\t\tGP - start stroke \n");
p->status= GP_STATUS_PAINTING;
/* no break now, since we should immediately start painting */