Fix T68414: GPencil crash after using L key and Ctrl+Z in Draw Mode

There is a segment fault because the operator was in modal but the Ctrl+Z breaks the custom data. Now, the Ctrl+Z ends the operator.
This commit is contained in:
Antonio Vazquez 2019-08-10 10:44:44 +02:00
parent b91643c711
commit b99c616b9b
Notes: blender-bot 2023-02-14 08:38:14 +01:00
Referenced by issue #68414, Grease Pencil: L (key) / cmd z / crash
1 changed files with 7 additions and 1 deletions

View File

@ -3460,12 +3460,18 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* We don't pass on key events, GP is used with key-modifiers -
* prevents Dkey to insert drivers. */
if (ISKEYBOARD(event->type)) {
if (ELEM(event->type, LEFTARROWKEY, DOWNARROWKEY, RIGHTARROWKEY, UPARROWKEY, ZKEY)) {
if (ELEM(event->type, LEFTARROWKEY, DOWNARROWKEY, RIGHTARROWKEY, UPARROWKEY)) {
/* allow some keys:
* - for frame changing [#33412]
* - for undo (during sketching sessions)
*/
}
else if (event->type == ZKEY) {
if (event->ctrl) {
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
}
}
else if (ELEM(event->type, PAD0, PAD1, PAD2, PAD3, PAD4, PAD5, PAD6, PAD7, PAD8, PAD9)) {
/* allow numpad keys so that camera/view manipulations can still take place
* - PAD0 in particular is really important for Grease Pencil drawing,