From 6c923d7f60492e904486281b46ca9e1fbda4dc1d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 6 Nov 2007 12:53:04 +0000 Subject: [PATCH] Fix crash in Editor::sync_order_keys() when a route is removed. git-svn-id: svn://localhost/ardour2/trunk@2597 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_route_list.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index e941b4c1ce..b700f9e469 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -118,7 +118,7 @@ Editor::handle_new_route (Session::RouteList& routes) } ignore_route_list_reorder = false; - + tv->set_old_order_key (route_display_model->children().size() - 1); route->gui_changed.connect (mem_fun(*this, &Editor::handle_gui_changes)); @@ -162,7 +162,7 @@ Editor::remove_route (TimeAxisView *tv) TrackViewList::iterator i = find (track_views.begin(), track_views.end(), tv); /* set up `nearby' to be a suitable nearby track to select once - this one has gong */ + this one has gone */ TrackViewList::iterator nearby = track_views.end (); if (i != track_views.end()) { @@ -191,6 +191,14 @@ Editor::remove_route (TimeAxisView *tv) } } + /* Decrement old order keys for tracks `above' the one that is being removed */ + for (ri = rows.begin(); ri != rows.end(); ++ri) { + TimeAxisView* v = (*ri)[route_display_columns.tv]; + if (v->old_order_key() > tv->old_order_key()) { + v->set_old_order_key (v->old_order_key() - 1); + } + } + for (ri = rows.begin(); ri != rows.end(); ++ri) { if ((*ri)[route_display_columns.tv] == tv) { route_display_model->erase (ri);