From c5618f01d61999cc95b1ed4264ce3a38ca0b07da Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 13 Oct 2020 03:49:19 +0200 Subject: [PATCH] VST3: only expose Mixbus sends via PSL extensions --- libs/ardour/vst3_plugin.cc | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/libs/ardour/vst3_plugin.cc b/libs/ardour/vst3_plugin.cc index 674dafe837..31d795cd98 100644 --- a/libs/ardour/vst3_plugin.cc +++ b/libs/ardour/vst3_plugin.cc @@ -2453,18 +2453,25 @@ lookup_ac (SessionObject* o, FIDString id) return s->gain_control (); } else if (0 == strncmp (id, ContextInfo::kSendLevel, strlen (ContextInfo::kSendLevel))) { #ifdef MIXBUS - /* This calls Route::nth_send(), which takes the _processor_lock. - * which we may already hold during initialzation - * (set_owner is called with process and processor locks held). + /* Only use mixbus sends, which are identified by providing a + * send_enable_controllable(). * - * NB "console 1" asks for 3 sends, even when we return - * kSendCount == 0. + * The main reason is that the number of Mixbus sends + * per route is fixed, but this also works around a crash: * - * In Mixbus it's fine, since Mixbus send lookup - * does not take the _processor_lock + * For Ardour sends, send_level_controllable() calls + * Route::nth_send() which takes the _processor_lock. + * + * However this callback can be triggered initially + * Route::add_processors () -> set_owner() -> + * setup_psl_info_handler() -> ..notify.. + * with process and processor locks held, leading to + * recurive locks (deadlock, or double unlock crash). */ int send_id = atoi (id + strlen (ContextInfo::kSendLevel)); - return s->send_level_controllable (send_id); + if (s->send_enable_controllable (send_id)) { + return s->send_level_controllable (send_id); + } #endif } return boost::shared_ptr ();