Commit: 7cbd1285a5522971c9e46e417d63bac8c07bc1a4
Author: Campbell Barton
Date:   Tue Jun 21 15:02:10 2016 +1000
Branches: master
https://developer.blender.org/rB7cbd1285a5522971c9e46e417d63bac8c07bc1a4

Fix T48196: Crash enabling modal operator in exec

Not good practice, but better not crash.

===================================================================

M       source/blender/windowmanager/intern/wm_event_system.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index 4f9d484..f632dd9 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;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to