From 3d44f39c090005dcbabbd588fbe51a92f8e2966a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 4 Feb 2021 04:40:53 +0100 Subject: [PATCH] Report failed connections when reconnecting ports This is needed to update the GUI (mixer-strip I/O buttons) when the engine is re-started with different I/O. When Port::reconnect() cannot re-connect the port (e.g. because the corresponding hardware port is missing), the IO object needs o be notified -> PostDisconnect() -> IO::disconnect_check. While the port-manager re-establishes and re-connects port, port_manager->running() == false, and Port::get_connections() returns the Port::_connections set (not actual engine connections). So _connections.clear() has to be called synchronize it with the actual engine connection state. --- libs/ardour/port.cc | 1 + libs/ardour/port_manager.cc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc index 63cc64aa89..72256090ff 100644 --- a/libs/ardour/port.cc +++ b/libs/ardour/port.cc @@ -566,6 +566,7 @@ Port::reconnect () for (std::set::iterator i = _connections.begin(); i != _connections.end(); ++i) { if (connect (*i)) { + _connections.clear (); return -1; } } diff --git a/libs/ardour/port_manager.cc b/libs/ardour/port_manager.cc index de4c972e2e..00df3ebecb 100644 --- a/libs/ardour/port_manager.cc +++ b/libs/ardour/port_manager.cc @@ -772,7 +772,9 @@ PortManager::reconnect_ports () DEBUG_TRACE (DEBUG::Ports, string_compose ("reconnect %1 ports\n", p->size())); for (Ports::iterator i = p->begin(); i != p->end(); ++i) { - i->second->reconnect (); + if (i->second->reconnect ()) { + PortConnectedOrDisconnected (i->second, i->first, boost::weak_ptr(), "", false); + } } return 0;