From 6de0f8a8a8348b502344bbd3a50b8c54f4d7afaf Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 21 Nov 2011 22:38:44 +0000 Subject: [PATCH] Sort session routes before trying to do the group tabs collection; should fix #4500. git-svn-id: svn://localhost/ardour2/branches/3.0@10749 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/group_tabs.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc index c1b6e5142d..08dfe539a2 100644 --- a/gtk2_ardour/group_tabs.cc +++ b/gtk2_ardour/group_tabs.cc @@ -432,13 +432,24 @@ GroupTabs::subgroup (RouteGroup* g, bool aux, Placement placement) } struct CollectSorter { - CollectSorter (std::string const & key) : _key (key) {} + CollectSorter (string const & key) : _key (key) {} bool operator () (boost::shared_ptr a, boost::shared_ptr b) { return a->order_key (_key) < b->order_key (_key); } - std::string _key; + string _key; +}; + +struct OrderSorter { + OrderSorter (string const & key) : _key (key) {} + + bool operator() (boost::shared_ptr a, boost::shared_ptr b) { + /* use of ">" forces the correct sort order */ + return a->order_key (_key) < b->order_key (_key); + } + + string _key; }; /** Collect all members of a RouteGroup so that they are together in the Editor or Mixer. @@ -453,6 +464,7 @@ GroupTabs::collect (RouteGroup* g) RouteList::iterator i = group_routes->begin (); boost::shared_ptr routes = _session->get_routes (); + routes->sort (OrderSorter (order_key ())); RouteList::const_iterator j = routes->begin (); int diff = 0;