diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index be2106049c..57354bb8ef 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -6408,11 +6408,11 @@ Session::route_removed_from_route_group (RouteGroup* rg, std::weak_ptr r) std::shared_ptr Session::get_nth_audio_track (uint32_t nth) const { - std::shared_ptr rl = routes.reader (); - rl->sort (Stripable::Sorter ()); + RouteList rl (*(routes.reader ())); + rl.sort (Stripable::Sorter()); - for (RouteList::const_iterator r = rl->begin(); r != rl->end(); ++r) { - std::shared_ptr at = std::dynamic_pointer_cast (*r); + for (auto const& r: rl) { + std::shared_ptr at = std::dynamic_pointer_cast (r); if (!at) { continue; }