summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-12 06:21:23 +0000
committerDavid Robillard <d@drobilla.net>2012-05-12 06:21:23 +0000
commit2e8a9b483a8d2ca7ba2a4feb4a845a32ab1eebeb (patch)
tree840b53a3be7071123718281c1ad62258fb6cb5f4 /src/server
parent1d9bb9768f8a7d0c76fa33688051cd8f2715075d (diff)
downloadingen-2e8a9b483a8d2ca7ba2a4feb4a845a32ab1eebeb.tar.gz
ingen-2e8a9b483a8d2ca7ba2a4feb4a845a32ab1eebeb.tar.bz2
ingen-2e8a9b483a8d2ca7ba2a4feb4a845a32ab1eebeb.zip
Fix memory errors when running as LV2 plugin.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4375 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server')
-rw-r--r--src/server/events/SetMetadata.cpp6
-rw-r--r--src/server/ingen_lv2.cpp17
2 files changed, 14 insertions, 9 deletions
diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp
index 5849269a..15ed26cc 100644
--- a/src/server/events/SetMetadata.cpp
+++ b/src/server/events/SetMetadata.cpp
@@ -317,9 +317,9 @@ SetMetadata::execute(ProcessContext& context)
break;
case POLYPHONY:
if (_patch->internal_poly() != static_cast<uint32_t>(value.get_int32()) &&
- !_patch->apply_internal_poly(_engine.process_context(),
- *_engine.buffer_factory(),
- *_engine.maid(), value.get_int32())) {
+ !_patch->apply_internal_poly(context,
+ *_engine.buffer_factory(),
+ *_engine.maid(), value.get_int32())) {
_status = INTERNAL_ERROR;
}
break;
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index b33f412a..e9852534 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -316,7 +316,14 @@ private:
};
struct IngenPlugin {
- Ingen::Shared::Forge forge;
+ IngenPlugin()
+ : world(NULL)
+ , main(NULL)
+ , map(NULL)
+ , argc(0)
+ , argv(NULL)
+ {}
+
Ingen::Shared::World* world;
MainThread* main;
LV2_URID_Map* map;
@@ -386,10 +393,8 @@ ingen_instantiate(const LV2_Descriptor* descriptor,
return NULL;
}
- IngenPlugin* plugin = (IngenPlugin*)malloc(sizeof(IngenPlugin));
- plugin->main = NULL;
- plugin->map = NULL;
- LV2_URID_Unmap* unmap = NULL;
+ IngenPlugin* plugin = new IngenPlugin();
+ LV2_URID_Unmap* unmap = NULL;
for (int i = 0; features[i]; ++i) {
if (!strcmp(features[i]->URI, LV2_URID_URI "#map")) {
plugin->map = (LV2_URID_Map*)features[i]->data;
@@ -499,7 +504,7 @@ ingen_cleanup(LV2_Handle instance)
me->world->set_engine(SharedPtr<Ingen::Server::Engine>());
me->world->set_interface(SharedPtr<Ingen::Interface>());
delete me->world;
- free(instance);
+ delete me;
}
static void