mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 08:14:58 +01:00
Fix #9961, update saved port-name references when renaming ports
Since internal connections are saved by port-name, renaming a port also needs to update references that other ports have.
This commit is contained in:
parent
c8540a5ad6
commit
96431aa0d6
3 changed files with 16 additions and 0 deletions
|
|
@ -135,6 +135,8 @@ public:
|
|||
uint32_t externally_connected () const { return _externally_connected; }
|
||||
uint32_t internally_connected () const { return _internally_connected; }
|
||||
|
||||
void rename_connected_port (std::string const&, std::string const&);
|
||||
|
||||
void increment_external_connections ();
|
||||
void decrement_external_connections ();
|
||||
|
||||
|
|
|
|||
|
|
@ -224,6 +224,17 @@ Port::erase_connection (std::string const& pn)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Port::rename_connected_port (std::string const& old_name, std::string const& new_name)
|
||||
{
|
||||
Glib::Threads::RWLock::WriterLock lm (_connections_lock);
|
||||
if (_int_connections.find (old_name) == _int_connections.end()) {
|
||||
return;
|
||||
}
|
||||
_int_connections.erase (old_name);
|
||||
_int_connections.insert (new_name);
|
||||
}
|
||||
|
||||
void
|
||||
Port::increment_external_connections ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -551,6 +551,9 @@ PortManager::port_renamed (const std::string& old_relative_name, const std::stri
|
|||
if (x != p->end ()) {
|
||||
std::shared_ptr<Port> port = x->second;
|
||||
p->erase (x);
|
||||
for (auto& [pn, pt] : *p) {
|
||||
pt->rename_connected_port (old_relative_name, new_relative_name);
|
||||
}
|
||||
p->insert (make_pair (new_relative_name, port));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue