summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-22 22:38:35 +0000
committerDavid Robillard <d@drobilla.net>2010-02-22 22:38:35 +0000
commitde5fbd4001ae2d8db2edc9abdd2d757587047ecb (patch)
treef53ea8842d35dbb1b1185fe7f21d72ac371c2544
parent82a5ccf59231f7ff7d0a2a9c9299fba15985c232 (diff)
downloadingen-de5fbd4001ae2d8db2edc9abdd2d757587047ecb.tar.gz
ingen-de5fbd4001ae2d8db2edc9abdd2d757587047ecb.tar.bz2
ingen-de5fbd4001ae2d8db2edc9abdd2d757587047ecb.zip
Fail gracefully when LV2 plugins have illegal symbols.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2478 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/engine/LV2Node.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/engine/LV2Node.cpp b/src/engine/LV2Node.cpp
index 9f3995ca..e995bec3 100644
--- a/src/engine/LV2Node.cpp
+++ b/src/engine/LV2Node.cpp
@@ -209,6 +209,14 @@ LV2Node::instantiate(BufferFactory& bufs)
// LV2 port symbols are guaranteed to be unique, valid C identifiers
port_name = slv2_value_as_string(slv2_port_get_symbol(plug, id));
+
+ if (!Symbol::is_valid(port_name)) {
+ error << "Plugin " << _lv2_plugin->uri() << " port " << j
+ << " has illegal symbol `" << port_name << "'" << endl;
+ ret = false;
+ break;
+ }
+
assert(port_name.find("/") == string::npos);
port_path = path().child(port_name);
@@ -261,12 +269,8 @@ LV2Node::instantiate(BufferFactory& bufs)
}
if (data_type == PortType::UNKNOWN || direction == UNKNOWN) {
- delete _ports;
- _ports = NULL;
- delete _instances;
- _instances = NULL;
ret = false;
- goto done;
+ break;
}
if (val.type() == Atom::NIL)
@@ -319,7 +323,16 @@ LV2Node::instantiate(BufferFactory& bufs)
_ports->at(j) = port;
}
-done:
+ if (!ret) {
+ for (uint32_t i = 0; i < _polyphony; ++i) {
+ slv2_instance_deactivate((*_instances)[i]);
+ }
+ delete _ports;
+ _ports = NULL;
+ delete _instances;
+ _instances = NULL;
+ }
+
delete[] min_values;
delete[] max_values;
delete[] def_values;