summaryrefslogtreecommitdiff
path: root/libs/ardour/lv2_plugin.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-03-22 14:09:03 +0100
committerRobin Gareus <robin@gareus.org>2019-03-22 14:09:03 +0100
commite398656940fdc931f58a9a502134bbe3574b4f2a (patch)
treec485bbc88b9a610750b25f6085b820e345ffe551 /libs/ardour/lv2_plugin.cc
parent5372f9182de410217bbc410af73e4e31efb4c24c (diff)
Prevent crashes when copying LV2 plugin state
LV2 plugin state-loading is generally safe to perform concurrently with running the plugin (as per LV2 spec). However concurrent run() is not.
Diffstat (limited to 'libs/ardour/lv2_plugin.cc')
-rw-r--r--libs/ardour/lv2_plugin.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index c4a1e0c24f..2b45e9e28a 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -2197,7 +2197,17 @@ LV2Plugin::set_state(const XMLNode& node, int version)
set_state_dir ("");
}
- latency_compute_run();
+ /* Do not call latency_compute_run() concurrently with connect_and_run().
+ * So far this can only guarnteed when the session is loading,
+ * and the plugin has not been added to the processor chain.
+ *
+ * Ideally this would clso be called when copying a plugin from another track,
+ * but NOT when copying the state from a plugin to another (active) plugin
+ * instance.
+ */
+ if (_session.loading ()) {
+ latency_compute_run();
+ }
#endif
return Plugin::set_state(node, version);