diff options
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 4f9d48450f6..f632dd9aff4 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -793,7 +793,10 @@ static int wm_operator_exec(bContext *C, wmOperator *op, const bool repeat, cons wm_operator_finished(C, op, repeat); } else if (repeat == 0) { - WM_operator_free(op); + /* warning: modal from exec is bad practice, but avoid crashing. */ + if (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED)) { + WM_operator_free(op); + } } return retval | OPERATOR_HANDLED; |