summaryrefslogtreecommitdiffstats
path: root/src/engine/NodeFactory.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-04 23:53:37 +0000
committerDavid Robillard <d@drobilla.net>2010-02-04 23:53:37 +0000
commit16edd7b1272e91a5ef28e8b9211b8d5721fafe23 (patch)
treedeb678753bb3e74c9f8da1121b7a9c79c13ec753 /src/engine/NodeFactory.cpp
parent6f3a80bb9c80b8e0cf486d198c2e107512b2cc46 (diff)
downloadingen-16edd7b1272e91a5ef28e8b9211b8d5721fafe23.tar.gz
ingen-16edd7b1272e91a5ef28e8b9211b8d5721fafe23.tar.bz2
ingen-16edd7b1272e91a5ef28e8b9211b8d5721fafe23.zip
Fix a bunch of memory leaks.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2429 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/NodeFactory.cpp')
-rw-r--r--src/engine/NodeFactory.cpp35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/engine/NodeFactory.cpp b/src/engine/NodeFactory.cpp
index 335feb26..28920d3c 100644
--- a/src/engine/NodeFactory.cpp
+++ b/src/engine/NodeFactory.cpp
@@ -137,26 +137,14 @@ NodeFactory::load_plugins()
void
NodeFactory::load_internal_plugins()
{
- // FIXME: This is a touch gross...
-
- const SampleRate r = 48000;
- const size_t s = sizeof(Sample);
-
- Engine& engine = *_world->local_engine;
- PatchImpl* parent = new PatchImpl(engine, "dummy", 1, NULL, r, s, 1);
-
- NodeImpl* n = NULL;
- n = new NoteNode(*engine.buffer_factory(), "foo", 1, parent, r, s);
- _plugins.insert(make_pair(n->plugin_impl()->uri(), n->plugin_impl()));
- delete n;
- n = new TriggerNode(*engine.buffer_factory(), "foo", 1, parent, r, s);
- _plugins.insert(make_pair(n->plugin_impl()->uri(), n->plugin_impl()));
- delete n;
- n = new ControllerNode(*engine.buffer_factory(), "foo", 1, parent, r, s);
- _plugins.insert(make_pair(n->plugin_impl()->uri(), n->plugin_impl()));
- delete n;
-
- delete parent;
+ InternalPlugin& note_plug = NoteNode::internal_plugin();
+ _plugins.insert(make_pair(note_plug.uri(), &note_plug));
+
+ InternalPlugin& trigger_plug = TriggerNode::internal_plugin();
+ _plugins.insert(make_pair(trigger_plug.uri(), &trigger_plug));
+
+ InternalPlugin& controller_plug = ControllerNode::internal_plugin();
+ _plugins.insert(make_pair(controller_plug.uri(), &controller_plug));
}
@@ -238,8 +226,13 @@ NodeFactory::load_ladspa_plugins()
continue;
Glib::Module* plugin_library = new Glib::Module(lib_path, Glib::MODULE_BIND_LOCAL);
- if (!plugin_library || !(*plugin_library))
+ if (!plugin_library)
+ continue;
+
+ if (!(*plugin_library)) {
+ delete plugin_library;
continue;
+ }
bool found = plugin_library->get_symbol("ladspa_descriptor", df.dp);
if (!found || !df.dp) {