Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-06-06 15:04:54 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-06-06 15:04:54 +0400
commita43309e8d4fc09d31acb4030b13f1c22c9ddf22a (patch)
treeebc83c257a1a9366f48273178971aa00cdfc1c99 /source/blender/editors/space_node/node_edit.c
parent4d0026f7b9995a9d51fc485f83b8d68a30362fbc (diff)
Added cancel callbacks to modal operators which allocates memory
in invoke callback. This prevents unfreed memory blocks when quiting Bledner with modal operator running.
Diffstat (limited to 'source/blender/editors/space_node/node_edit.c')
-rw-r--r--source/blender/editors/space_node/node_edit.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index d967e2240e6..99f2ea99efc 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -1086,6 +1086,13 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
+static int snode_bg_viewmove_cancel(bContext *UNUSED(C), wmOperator *op)
+{
+ MEM_freeN(op->customdata);
+ op->customdata= NULL;
+
+ return OPERATOR_CANCELLED;
+}
void NODE_OT_backimage_move(wmOperatorType *ot)
{
@@ -1098,6 +1105,7 @@ void NODE_OT_backimage_move(wmOperatorType *ot)
ot->invoke= snode_bg_viewmove_invoke;
ot->modal= snode_bg_viewmove_modal;
ot->poll= composite_node_active;
+ ot->cancel= snode_bg_viewmove_cancel;
/* flags */
ot->flag= OPTYPE_BLOCKING;
@@ -1384,6 +1392,14 @@ static int node_resize_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
}
+static int node_resize_cancel(bContext *UNUSED(C), wmOperator *op)
+{
+ MEM_freeN(op->customdata);
+ op->customdata= NULL;
+
+ return OPERATOR_CANCELLED;
+}
+
void NODE_OT_resize(wmOperatorType *ot)
{
/* identifiers */
@@ -1394,6 +1410,7 @@ void NODE_OT_resize(wmOperatorType *ot)
ot->invoke= node_resize_invoke;
ot->modal= node_resize_modal;
ot->poll= ED_operator_node_active;
+ ot->cancel= node_resize_cancel;
/* flags */
ot->flag= OPTYPE_BLOCKING;
@@ -2279,6 +2296,18 @@ static int node_link_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
}
+static int node_link_cancel(bContext *C, wmOperator *op)
+{
+ SpaceNode *snode= CTX_wm_space_node(C);
+ bNodeLinkDrag *nldrag= op->customdata;
+
+ nodeRemLink(snode->edittree, nldrag->link);
+ BLI_remlink(&snode->linkdrag, nldrag);
+ MEM_freeN(nldrag);
+
+ return OPERATOR_CANCELLED;
+}
+
void NODE_OT_link(wmOperatorType *ot)
{
/* identifiers */
@@ -2290,6 +2319,7 @@ void NODE_OT_link(wmOperatorType *ot)
ot->modal= node_link_modal;
// ot->exec= node_link_exec;
ot->poll= ED_operator_node_active;
+ ot->cancel= node_link_cancel;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
@@ -2402,6 +2432,7 @@ void NODE_OT_links_cut(wmOperatorType *ot)
ot->invoke= WM_gesture_lines_invoke;
ot->modal= WM_gesture_lines_modal;
ot->exec= cut_links_exec;
+ ot->cancel= WM_gesture_lines_cancel;
ot->poll= ED_operator_node_active;