summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2018-03-20 18:07:55 +0100
committerRobin Gareus <robin@gareus.org>2018-03-20 18:08:12 +0100
commite7f6eff84b52018399c8170ada637136437f1cb5 (patch)
tree08cc1344f309f4817d67a30ab5dbf09cf2b61ccc
parent5385aece9438282d5a3f1ec5a693488aa1499626 (diff)
Fix crash when re-assigning groups to a disjunct set.
Drag a group-tab's right-edge horizontally to the right to remove all current routes from the groups before adding new routes to the group. The group becomes temporarily empty, and Session::route_removed_from_route_group() removes the group (before new routes can be added).
-rw-r--r--gtk2_ardour/group_tabs.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc
index 303f4abac7..4c17064e76 100644
--- a/gtk2_ardour/group_tabs.cc
+++ b/gtk2_ardour/group_tabs.cc
@@ -212,7 +212,15 @@ GroupTabs::on_button_release_event (GdkEventButton*)
run_new_group_dialog (&routes, false);
} else {
boost::shared_ptr<RouteList> r = _session->get_routes ();
- for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+ /* First add new ones, then remove old ones.
+ * We cannot allow the group to become temporarily empty, because
+ * Session::route_removed_from_route_group() will delete empty groups.
+ */
+ for (RouteList::const_iterator i = routes.begin(); i != routes.end(); ++i) {
+ /* RouteGroup::add () ignores routes already present in the set */
+ _dragging->group->add (*i);
+ }
+ for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
bool const was_in_tab = find (
_initial_dragging_routes.begin(), _initial_dragging_routes.end(), *i
@@ -222,10 +230,9 @@ GroupTabs::on_button_release_event (GdkEventButton*)
if (was_in_tab && !now_in_tab) {
_dragging->group->remove (*i);
- } else if (!was_in_tab && now_in_tab) {
- _dragging->group->add (*i);
}
}
+
}
}