Prevent duplicate Ctrl-protocol instances
authorRobin Gareus <robin@gareus.org>
Thu, 5 Sep 2019 16:59:26 +0000 (18:59 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 5 Sep 2019 16:59:26 +0000 (18:59 +0200)
ControlProtocols are single instance.

Activating an already active protocol leads to crashes due to
various rasons (e.g. port already registered), re-used singleton
event_loop_name and request-buffers, duplicate free of
AbstractUI request buffers during deactivate,..

libs/ardour/control_protocol_manager.cc

index eabc4e5006215973bf56dddaa1e8301f517150fa..c7be44a4c895507f38ca1a526d1621b5f6f6c693 100644 (file)
@@ -129,6 +129,11 @@ ControlProtocolManager::activate (ControlProtocolInfo& cpi)
 
        cpi.requested = true;
 
+       if (cpi.protocol && cpi.protocol->active()) {
+               warning << string_compose (_("Control protocol %1 was already active."), cpi.name) << endmsg;
+               return 0;
+       }
+
        if ((cp = instantiate (cpi)) == 0) {
                return -1;
        }