From ad4dc4460d25fb5cef3bda2fd3f4fcaab0b5ff5f Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 7 Oct 2018 12:43:28 -0400 Subject: [PATCH] fix duplicate name check for new transport master --- libs/ardour/transport_master_manager.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libs/ardour/transport_master_manager.cc b/libs/ardour/transport_master_manager.cc index 1eed0e5d1f..063224632c 100644 --- a/libs/ardour/transport_master_manager.cc +++ b/libs/ardour/transport_master_manager.cc @@ -315,6 +315,14 @@ TransportMasterManager::add (SyncSource type, std::string const & name, bool rem { Glib::Threads::RWLock::WriterLock lm (lock); + + for (TransportMasters::const_iterator t = _transport_masters.begin(); t != _transport_masters.end(); ++t) { + if ((*t)->name() == name) { + error << string_compose (_("There is already a transport master named \"%1\" - not duplicated"), name) << endmsg; + return -1; + } + } + tm = TransportMaster::factory (type, name, removeable); ret = add_locked (tm); } @@ -333,12 +341,6 @@ TransportMasterManager::add_locked (boost::shared_ptr tm) return -1; } - for (TransportMasters::const_iterator t = _transport_masters.begin(); t != _transport_masters.end(); ++t) { - if ((*t)->name() == tm->name()) { - error << string_compose (_("There is already a transport master named \"%1\" - not duplicated"), tm->name()) << endmsg; - return -1; - } - } if (_session) { tm->set_session (_session);