From d22f6503008f738b5cf7dcb58212e1be503a54f4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 21 Dec 2012 21:10:54 +0000 Subject: Fix memory leaks. Add missing library dependencies. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4880 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/events/Connect.cpp | 3 +-- src/server/events/CreateBlock.cpp | 9 +++++++-- src/server/events/CreateBlock.hpp | 2 ++ src/server/events/CreateGraph.cpp | 3 +-- src/server/events/Delete.cpp | 3 +-- src/server/events/Delta.cpp | 3 +-- src/server/events/Disconnect.cpp | 3 +-- src/server/events/DisconnectAll.cpp | 3 +-- 8 files changed, 15 insertions(+), 14 deletions(-) (limited to 'src/server/events') diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index e0d1b091..8a4d07a5 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -146,8 +146,7 @@ Connect::execute(ProcessContext& context) _head->add_edge(context, _edge.get()); _engine.maid()->dispose(_head->set_buffers(context, _buffers)); _head->connect_buffers(); - _engine.maid()->dispose(_graph->compiled_graph()); - _graph->compiled_graph(_compiled_graph); + _graph->set_compiled_graph(_compiled_graph); } } diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp index 4c6fda5c..f0557a47 100644 --- a/src/server/events/CreateBlock.cpp +++ b/src/server/events/CreateBlock.cpp @@ -46,6 +46,11 @@ CreateBlock::CreateBlock(Engine& engine, , _compiled_graph(NULL) {} +CreateBlock::~CreateBlock() +{ + delete _compiled_graph; +} + bool CreateBlock::pre_process() { @@ -124,8 +129,8 @@ void CreateBlock::execute(ProcessContext& context) { if (_block) { - _engine.maid()->dispose(_graph->compiled_graph()); - _graph->compiled_graph(_compiled_graph); + _graph->set_compiled_graph(_compiled_graph); + _compiled_graph = NULL; // Graph takes ownership } } diff --git a/src/server/events/CreateBlock.hpp b/src/server/events/CreateBlock.hpp index da444b1f..4b706e53 100644 --- a/src/server/events/CreateBlock.hpp +++ b/src/server/events/CreateBlock.hpp @@ -47,6 +47,8 @@ public: const Raul::Path& block_path, const Resource::Properties& properties); + ~CreateBlock(); + bool pre_process(); void execute(ProcessContext& context); void post_process(); diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index c55acd87..23c6ef14 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -103,8 +103,7 @@ void CreateGraph::execute(ProcessContext& context) { if (_graph) { - _engine.maid()->dispose(_parent->compiled_graph()); - _parent->compiled_graph(_compiled_graph); + _parent->set_compiled_graph(_compiled_graph); } } diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index a1d96960..d221a8ef 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -134,8 +134,7 @@ Delete::execute(ProcessContext& context) } if (parent) { - _engine.maid()->dispose(parent->compiled_graph()); - parent->compiled_graph(_compiled_graph); + parent->set_compiled_graph(_compiled_graph); } } diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index f22a928f..c7a2fb10 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -294,8 +294,7 @@ Delta::execute(ProcessContext& context) case ENABLE: if (value.get_bool()) { if (_compiled_graph) { - _engine.maid()->dispose(_graph->compiled_graph()); - _graph->compiled_graph(_compiled_graph); + _graph->set_compiled_graph(_compiled_graph); } _graph->enable(); } else { diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 355d90c8..f8284190 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -204,8 +204,7 @@ Disconnect::execute(ProcessContext& context) return; } - _engine.maid()->dispose(_graph->compiled_graph()); - _graph->compiled_graph(_compiled_graph); + _graph->set_compiled_graph(_compiled_graph); } } diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index f96fd4d7..b3e24e3f 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -154,8 +154,7 @@ DisconnectAll::execute(ProcessContext& context) } } - _engine.maid()->dispose(_parent->compiled_graph()); - _parent->compiled_graph(_compiled_graph); + _parent->set_compiled_graph(_compiled_graph); } void -- cgit v1.2.1