diff --git a/gtk2_ardour/export_channel_selector.cc b/gtk2_ardour/export_channel_selector.cc index c7f25b9e30..087a981ce4 100644 --- a/gtk2_ardour/export_channel_selector.cc +++ b/gtk2_ardour/export_channel_selector.cc @@ -733,8 +733,8 @@ TrackExportChannelSelector::sync_with_manager_state () PortExportChannel::PortSet route_ports; PortExportChannel::PortSet intersection; - PortSet& ps (route->output()->ports ()); - for (PortSet::audio_iterator p = ps.audio_begin (); p != ps.audio_end (); ++p) { + std::shared_ptr ps (route->output()->ports ()); + for (PortSet::audio_iterator p = ps->audio_begin (); p != ps->audio_end (); ++p) { route_ports.insert (*p); } diff --git a/gtk2_ardour/io_button.cc b/gtk2_ardour/io_button.cc index 3f153d1683..54b96f6823 100644 --- a/gtk2_ardour/io_button.cc +++ b/gtk2_ardour/io_button.cc @@ -60,11 +60,12 @@ exclusively_connected (std::shared_ptr dest_io, std::shared_ptr io, Data uint32_t n = 0; uint32_t cnt = 0; std::set pn; - PortSet const& psa (dest_io->ports ()); - PortSet const& psb (io->ports ()); - for (auto a = psa.begin (dt); a != psa.end (dt); ++a, ++n) { - for (auto b = psb.begin (dt); b != psb.end (dt); ++b) { + std::shared_ptr psa (dest_io->ports ()); + std::shared_ptr psb (io->ports ()); + + for (auto a = psa->begin (dt); a != psa->end (dt); ++a, ++n) { + for (auto b = psb->begin (dt); b != psb->end (dt); ++b) { if (a->connected_to (b->name ())) { ++cnt; pn.insert (n); @@ -117,7 +118,7 @@ IOButtonBase::guess_main_type (std::shared_ptr io) /* Find most likely type among connected ports */ DataType type = DataType::NIL; /* NIL is always last so least likely */ - for (PortSet::iterator p = io->ports ().begin (); p != io->ports ().end (); ++p) { + for (auto const& p : *io->ports ()) { if (p->connected () && p->type () < type) type = p->type (); } @@ -213,7 +214,7 @@ IOButtonBase::set_label (IOButtonBase& self, ARDOUR::Session& session, std::shar vector port_connections; - for (auto const& port : io->ports ()) { + for (auto const& port : *io->ports ()) { port_connections.clear (); port->get_connections (port_connections); @@ -306,8 +307,9 @@ IOButtonBase::set_label (IOButtonBase& self, ARDOUR::Session& session, std::shar session.engine ().get_physical_outputs (dt, phys); playorcapture = "playback_"; } - for (PortSet::iterator port = io->ports ().begin (dt); - port != io->ports ().end (dt); + std::shared_ptr ps (io->ports ()); + for (PortSet::iterator port = ps->begin (dt); + port != ps->end (dt); ++port) { string pn = ""; for (auto const& s : phys) { @@ -328,7 +330,7 @@ IOButtonBase::set_label (IOButtonBase& self, ARDOUR::Session& session, std::shar temp_label.str (""); /* erase the failed attempt */ break; } - if (port != io->ports ().begin (dt)) { + if (port != ps->begin (dt)) { temp_label << "/"; } temp_label << pn; @@ -368,10 +370,11 @@ IOButtonBase::set_label (IOButtonBase& self, ARDOUR::Session& session, std::shar /* Is each main-typed channel connected to a single and different port with * the same client name (e.g. another JACK client) ? */ if (!have_label && each_typed_port_has_one_connection) { - string maybe_client = ""; - vector connections; - for (PortSet::iterator port = io->ports ().begin (dt); - port != io->ports ().end (dt); + string maybe_client = ""; + vector connections; + std::shared_ptr ps (io->ports ()); + for (PortSet::iterator port = ps->begin (dt); + port != ps->end (dt); ++port) { port_connections.clear (); port->get_connections (port_connections); diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc index 4f671074e4..5b64ceb5ff 100644 --- a/gtk2_ardour/io_selector.cc +++ b/gtk2_ardour/io_selector.cc @@ -79,7 +79,7 @@ IOSelector::setup_type () int N = 0; DataType type_with_ports = DataType::NIL; for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) { - if (_io->ports().num_ports (*i)) { + if (_io->ports()->num_ports (*i)) { type_with_ports = *i; ++N; } diff --git a/gtk2_ardour/plugin_pin_dialog.cc b/gtk2_ardour/plugin_pin_dialog.cc index acce858f9f..e847f5a5e2 100644 --- a/gtk2_ardour/plugin_pin_dialog.cc +++ b/gtk2_ardour/plugin_pin_dialog.cc @@ -482,12 +482,12 @@ PluginPinWidget::refill_sidechain_table () } uint32_t r = 0; - PortSet& p (io->ports ()); - bool can_remove = p.num_ports () > 1; - for (PortSet::iterator i = p.begin (DataType::MIDI); i != p.end (DataType::MIDI); ++i) { + std::shared_ptr p (io->ports ()); + bool can_remove = p->num_ports () > 1; + for (PortSet::iterator i = p->begin (DataType::MIDI); i != p->end (DataType::MIDI); ++i) { r += add_port_to_table (*i, r, can_remove); } - for (PortSet::iterator i = p.begin (DataType::AUDIO); i != p.end (DataType::AUDIO); ++i) { + for (PortSet::iterator i = p->begin (DataType::AUDIO); i != p->end (DataType::AUDIO); ++i) { r += add_port_to_table (*i, r, can_remove); } _sidechain_tbl->show_all (); @@ -1857,8 +1857,8 @@ PluginPinWidget::add_send_from (std::weak_ptr wp, std::weak_ptrdisconnect_all (); DataType dt = p->type (); - PortSet& ps (send->output ()->ports ()); - for (PortSet::iterator i = ps.begin (dt); i != ps.end (dt); ++i) { + std::shared_ptr ps (send->output ()->ports ()); + for (PortSet::iterator i = ps->begin (dt); i != ps->end (dt); ++i) { p->connect (&(**i)); } diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 531c368673..8dfc7fb2ec 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -636,8 +636,8 @@ ProcessorEntry::name (Width w) const if (send->remove_on_disconnect ()) { // assume it's a sidechain, find pretty name of connected port(s) - PortSet& ps (send->output ()->ports ()); - for (PortSet::iterator i = ps.begin (); i != ps.end () && pretty_ok; ++i) { + shared_ptr ps (send->output ()->ports ()); + for (auto i = ps->begin (); i != ps->end () && pretty_ok; ++i) { vector connections; if (i->get_connections (connections)) { vector::const_iterator ci;