diff options
author | Robin Gareus <robin@gareus.org> | 2016-04-26 02:26:20 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-04-26 02:26:20 +0200 |
commit | 2169de3975e8276233e2640391c8b526ec9e97fd (patch) | |
tree | d97f83aa87ce7e46567cc0519251e59df03295db /libs/backends/coreaudio | |
parent | 11a69068af7b5ea182996a2ddba15f5131aa003b (diff) |
keep portmap & portindex in sync when renaming ports
Fixes crash on session re-load (introduced in 800c8182 and fde99e68)
Diffstat (limited to 'libs/backends/coreaudio')
-rw-r--r-- | libs/backends/coreaudio/coreaudio_backend.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/backends/coreaudio/coreaudio_backend.cc b/libs/backends/coreaudio/coreaudio_backend.cc index 0047721d81..b1721dd2d5 100644 --- a/libs/backends/coreaudio/coreaudio_backend.cc +++ b/libs/backends/coreaudio/coreaudio_backend.cc @@ -902,11 +902,20 @@ CoreAudioBackend::port_name_size () const int CoreAudioBackend::set_port_name (PortEngine::PortHandle port, const std::string& name) { + std::string newname (_instance_name + ":" + name); if (!valid_port (port)) { PBD::warning << _("CoreAudioBackend::set_port_name: Invalid Port(s)") << endmsg; return -1; } - return static_cast<CoreBackendPort*>(port)->set_name (_instance_name + ":" + name); + if (find_port (newname)) { + PBD::error << _("CoreAudioBackend::set_port_name: Port with given name already exists") << endmsg; + return -1; + } + + CoreBackendPort* p = static_cast<CoreBackendPort*>(port); + _portmap.erase (p->name()); + _portmap.insert (make_pair (newname, p)); + return p->set_name (newname); } std::string |