diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-06-21 08:02:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-06-21 08:02:10 +0300 |
commit | 7cbd1285a5522971c9e46e417d63bac8c07bc1a4 (patch) | |
tree | a69de7073799a77d04200b99a3f53aed9f417ad9 /source/blender | |
parent | 994dd5c7c151d42d81f20a7aebaa7dee33814089 (diff) |
Fix T48196: Crash enabling modal operator in exec
Not good practice, but better not crash.
Diffstat (limited to 'source/blender')
-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; |