diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-12 20:04:58 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-12 20:04:58 +0400 |
commit | e1419a5bea6fb9c4ad35689919833e9ce731edaa (patch) | |
tree | 853b26c1dccc05c68d31806916a8f9fdb96c2f2d /source/blender/windowmanager | |
parent | cdb8e3956517cf3bb6a4de5e6b0884cb28bd98ee (diff) |
Fix #34126: report list memory leak when calling operator from python and the
operator context poll failing.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 3d510728684..7862d6286cf 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -590,6 +590,9 @@ static void wm_operator_finished(bContext *C, wmOperator *op, int repeat) } if (wm_operator_register_check(wm, op->type)) { + /* take ownership of reports (in case python provided own) */ + op->reports->flag |= RPT_FREE; + wm_operator_register(C, op); WM_operator_region_active_win_set(C); } @@ -935,6 +938,9 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, wm_operator_finished(C, op, 0); } else if (retval & OPERATOR_RUNNING_MODAL) { + /* take ownership of reports (in case python provided own) */ + op->reports->flag |= RPT_FREE; + /* grab cursor during blocking modal ops (X11) * Also check for macro */ @@ -1170,13 +1176,6 @@ int WM_operator_call_py(bContext *C, wmOperatorType *ot, short context, if (!is_undo && wm && (wm == CTX_wm_manager(C))) wm->op_undo_depth--; - /* keep the reports around if needed later */ - if ((retval & OPERATOR_RUNNING_MODAL) || - ((retval & OPERATOR_FINISHED) && wm_operator_register_check(CTX_wm_manager(C), ot))) - { - reports->flag |= RPT_FREE; /* let blender manage freeing */ - } - return retval; } |