From a43309e8d4fc09d31acb4030b13f1c22c9ddf22a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 6 Jun 2011 11:04:54 +0000 Subject: Added cancel callbacks to modal operators which allocates memory in invoke callback. This prevents unfreed memory blocks when quiting Bledner with modal operator running. --- source/blender/editors/animation/anim_channels_edit.c | 1 + source/blender/editors/animation/anim_markers.c | 7 ++++++- source/blender/editors/animation/anim_ops.c | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index f755df79986..9145cc2b79d 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1881,6 +1881,7 @@ static void ANIM_OT_channels_select_border(wmOperatorType *ot) ot->invoke= WM_border_select_invoke; ot->exec= animchannels_borderselect_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= animedit_poll_channels_nla_tweakmode_off; diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index c802ba621f1..c6e55427034 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -717,7 +717,7 @@ static void ed_marker_move_apply(wmOperator *op) } /* only for modal */ -static void ed_marker_move_cancel(bContext *C, wmOperator *op) +static int ed_marker_move_cancel(bContext *C, wmOperator *op) { RNA_int_set(op->ptr, "frames", 0); ed_marker_move_apply(op); @@ -725,6 +725,8 @@ static void ed_marker_move_cancel(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); WM_event_add_notifier(C, NC_ANIMATION|ND_MARKERS, NULL); + + return OPERATOR_CANCELLED; } @@ -886,6 +888,7 @@ static void MARKER_OT_move(wmOperatorType *ot) ot->invoke= ed_marker_move_invoke_wrapper; ot->modal= ed_marker_move_modal; ot->poll= ed_markers_poll_selected_markers; + ot->cancel= ed_marker_move_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER; @@ -980,6 +983,7 @@ static void MARKER_OT_duplicate(wmOperatorType *ot) ot->invoke= ed_marker_duplicate_invoke_wrapper; ot->modal= ed_marker_move_modal; ot->poll= ed_markers_poll_selected_markers; + ot->cancel= ed_marker_move_cancel; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -1185,6 +1189,7 @@ static void MARKER_OT_select_border(wmOperatorType *ot) ot->exec= ed_marker_border_select_exec; ot->invoke= ed_marker_select_border_invoke_wrapper; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= ed_markers_poll_markers_exist; diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 93d99c59a0e..0e0bf275d8f 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -224,6 +224,7 @@ static void ANIM_OT_previewrange_set(wmOperatorType *ot) ot->invoke= WM_border_select_invoke; ot->exec= previewrange_define_exec; ot->modal= WM_border_select_modal; + ot->cancel= WM_border_select_cancel; ot->poll= ED_operator_animview_active; -- cgit v1.2.3 From cec102e7813a6eeb45223be9c14d4850146f5d8e Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Wed, 8 Jun 2011 10:57:24 +0000 Subject: Bugfix [#27586] P for setting playback range is clamped to > 0 Thanks for the patch Bastien Montagne. Was just legacy code from 2.4x --- source/blender/editors/animation/anim_ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 0e0bf275d8f..7a94a21d41e 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -199,8 +199,8 @@ static int previewrange_define_exec(bContext *C, wmOperator *op) * - must clamp within allowable limits * - end must not be before start (though this won't occur most of the time) */ - if (sfra < 1) sfra = 1.0f; - if (efra < 1) efra = 1.0f; + FRAMENUMBER_MIN_CLAMP(sfra); + FRAMENUMBER_MIN_CLAMP(efra); if (efra < sfra) efra= sfra; scene->r.flag |= SCER_PRV_RANGE; -- cgit v1.2.3