diff options
author | David Robillard <d@drobilla.net> | 2012-12-21 21:10:54 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-12-21 21:10:54 +0000 |
commit | d22f6503008f738b5cf7dcb58212e1be503a54f4 (patch) | |
tree | 5bdb88048cbb88b3e542c476f39366c27cde7b8e /src/server | |
parent | 6b62e037f2f828ec6bf9c7e0066db32cfb54abef (diff) | |
download | ingen-d22f6503008f738b5cf7dcb58212e1be503a54f4.tar.gz ingen-d22f6503008f738b5cf7dcb58212e1be503a54f4.tar.bz2 ingen-d22f6503008f738b5cf7dcb58212e1be503a54f4.zip |
Fix memory leaks.
Add missing library dependencies.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4880 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/Engine.cpp | 2 | ||||
-rw-r--r-- | src/server/GraphImpl.cpp | 10 | ||||
-rw-r--r-- | src/server/GraphImpl.hpp | 3 | ||||
-rw-r--r-- | src/server/events/Connect.cpp | 3 | ||||
-rw-r--r-- | src/server/events/CreateBlock.cpp | 9 | ||||
-rw-r--r-- | src/server/events/CreateBlock.hpp | 2 | ||||
-rw-r--r-- | src/server/events/CreateGraph.cpp | 3 | ||||
-rw-r--r-- | src/server/events/Delete.cpp | 3 | ||||
-rw-r--r-- | src/server/events/Delta.cpp | 3 | ||||
-rw-r--r-- | src/server/events/Disconnect.cpp | 3 | ||||
-rw-r--r-- | src/server/events/DisconnectAll.cpp | 3 | ||||
-rw-r--r-- | src/server/wscript | 2 |
12 files changed, 28 insertions, 18 deletions
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp index 9bcc9163..fd96119b 100644 --- a/src/server/Engine.cpp +++ b/src/server/Engine.cpp @@ -208,7 +208,7 @@ Engine::activate() Resource::INTERNAL)); _root_graph->activate(*_buffer_factory); _world->store()->add(_root_graph); - _root_graph->compiled_graph(_root_graph->compile()); + _root_graph->set_compiled_graph(_root_graph->compile()); ProcessContext context(*this); diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp index 81c69b46..d5cf646c 100644 --- a/src/server/GraphImpl.cpp +++ b/src/server/GraphImpl.cpp @@ -19,6 +19,7 @@ #include "ingen/Log.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "raul/Maid.hpp" #include "BlockImpl.hpp" #include "BufferFactory.hpp" @@ -228,6 +229,15 @@ GraphImpl::has_edge(const PortImpl* tail, const PortImpl* dst_port) const return (i != _edges.end()); } +void +GraphImpl::set_compiled_graph(CompiledGraph* cg) +{ + if (_compiled_graph && _compiled_graph != cg) { + _engine.maid()->dispose(_compiled_graph); + } + _compiled_graph = cg; +} + uint32_t GraphImpl::num_ports_non_rt() const { diff --git a/src/server/GraphImpl.hpp b/src/server/GraphImpl.hpp index 1eb0945e..9ef707fc 100644 --- a/src/server/GraphImpl.hpp +++ b/src/server/GraphImpl.hpp @@ -135,8 +135,7 @@ public: bool has_edge(const PortImpl* tail, const PortImpl* head) const; - CompiledGraph* compiled_graph() { return _compiled_graph; } - void compiled_graph(CompiledGraph* cp) { _compiled_graph = cp; } + void set_compiled_graph(CompiledGraph* cp); Raul::Array<PortImpl*>* external_ports() { return _ports; } void external_ports(Raul::Array<PortImpl*>* pa) { _ports = pa; } 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 diff --git a/src/server/wscript b/src/server/wscript index b739017e..107db69d 100644 --- a/src/server/wscript +++ b/src/server/wscript @@ -54,7 +54,7 @@ def build(bld): target = 'ingen_server', install_path = '${LIBDIR}', use = 'libingen') - core_libs = 'GLIBMM GTHREAD LV2 LILV RAUL SORD' + core_libs = 'GLIBMM GTHREAD LV2 LILV RAUL SERD SORD' autowaf.use_lib(bld, obj, core_libs) if bld.env.BUILD_TESTS: |