summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-12-21 21:10:54 +0000
committerDavid Robillard <d@drobilla.net>2012-12-21 21:10:54 +0000
commitd22f6503008f738b5cf7dcb58212e1be503a54f4 (patch)
tree5bdb88048cbb88b3e542c476f39366c27cde7b8e
parent6b62e037f2f828ec6bf9c7e0066db32cfb54abef (diff)
downloadingen-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
-rw-r--r--src/client/wscript2
-rw-r--r--src/serialisation/wscript4
-rw-r--r--src/server/Engine.cpp2
-rw-r--r--src/server/GraphImpl.cpp10
-rw-r--r--src/server/GraphImpl.hpp3
-rw-r--r--src/server/events/Connect.cpp3
-rw-r--r--src/server/events/CreateBlock.cpp9
-rw-r--r--src/server/events/CreateBlock.hpp2
-rw-r--r--src/server/events/CreateGraph.cpp3
-rw-r--r--src/server/events/Delete.cpp3
-rw-r--r--src/server/events/Delta.cpp3
-rw-r--r--src/server/events/Disconnect.cpp3
-rw-r--r--src/server/events/DisconnectAll.cpp3
-rw-r--r--src/server/wscript2
-rw-r--r--src/wscript4
-rw-r--r--tests/ingen_test.cpp5
16 files changed, 37 insertions, 24 deletions
diff --git a/src/client/wscript b/src/client/wscript
index c2b12ef3..df575c0d 100644
--- a/src/client/wscript
+++ b/src/client/wscript
@@ -9,7 +9,7 @@ def build(bld):
target = 'ingen_client',
install_path = '${LIBDIR}',
use = 'libingen')
- autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV SUIL RAUL SORD SIGCPP')
+ autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV SUIL RAUL SERD SORD SIGCPP')
obj.source = '''
BlockModel.cpp
diff --git a/src/serialisation/wscript b/src/serialisation/wscript
index c362f29e..82aeffd4 100644
--- a/src/serialisation/wscript
+++ b/src/serialisation/wscript
@@ -12,7 +12,7 @@ def build(bld):
target = 'ingen_serialisation',
install_path = '${LIBDIR}',
use = 'libingen')
- autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SORD SRATOM')
+ autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SERD SORD SRATOM')
if bld.env.BUILD_TESTS:
obj = bld(features = 'c cshlib cxx cxxshlib',
@@ -27,4 +27,4 @@ def build(bld):
use = 'libingen_profiled',
lib = bld.env.INGEN_TEST_LIBS,
cxxflags = bld.env.INGEN_TEST_CXXFLAGS)
- autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SORD SRATOM')
+ autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SERD SORD SRATOM')
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:
diff --git a/src/wscript b/src/wscript
index 8ff69a91..f2b88c0d 100644
--- a/src/wscript
+++ b/src/wscript
@@ -28,7 +28,7 @@ def build(bld):
vnum = '0.0.0',
install_path = '${LIBDIR}',
lib = ['dl'])
- autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SORD LV2_MIDI')
+ autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SERD SORD SRATOM')
if bld.env.BUILD_TESTS:
obj = bld(features = 'cxx cxxshlib',
@@ -40,5 +40,5 @@ def build(bld):
install_path = '',
lib = ['dl'] + bld.env.INGEN_TEST_LIBS,
cxxflags = bld.env.INGEN_TEST_CXXFLAGS)
- autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SORD LV2_MIDI')
+ autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SERD SORD SRATOM')
diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp
index 4958142b..2e532701 100644
--- a/tests/ingen_test.cpp
+++ b/tests/ingen_test.cpp
@@ -207,7 +207,7 @@ main(int argc, char** argv)
client);
SerdURI cmds_base;
- const SerdNode cmds_file_uri = serd_node_new_file_uri(
+ SerdNode cmds_file_uri = serd_node_new_file_uri(
(const uint8_t*)cmds_file_path.c_str(),
NULL, &cmds_base, false);
Sord::Model* cmds = new Sord::Model(*world->rdf_world(),
@@ -248,7 +248,10 @@ main(int argc, char** argv)
g_usleep(1000);
}
}
+ free((void*)out.buf);
serd_env_free(env);
+ sratom_free(sratom);
+ serd_node_free(&cmds_file_uri);
delete cmds;
// Shut down