From 617caf9e98d443c22cebc96a417b85a2bf8a8e56 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 4 May 2023 18:42:30 +0200 Subject: [PATCH] CPM: precent concurrent protocol activision This can happen when a device is already connected while Arodur is stating. The butler thread may activate it (immediately post-engine), while the GUI thread tries to do the same later when restoring state. --- libs/ardour/control_protocol_manager.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc index e377590389..f10b58f608 100644 --- a/libs/ardour/control_protocol_manager.cc +++ b/libs/ardour/control_protocol_manager.cc @@ -194,16 +194,15 @@ ControlProtocolManager::set_session (Session* s) int ControlProtocolManager::activate (ControlProtocolInfo& cpi) { + Glib::Threads::RWLock::WriterLock lm (protocols_lock); ControlProtocol* cp; - cpi.requested = true; - if (cpi.protocol && cpi.protocol->active()) { - warning << string_compose (_("Control protocol %1 was already active."), cpi.name) << endmsg; return 0; } - Glib::Threads::RWLock::WriterLock lm (protocols_lock); + cpi.requested = true; + if ((cp = instantiate (cpi)) == 0) { return -1; }