Prevent a crash in the situation where:

1. session teardown starts
 2. editor responds by removing and destroying all TimeAxisViews
 3. session then asks all routes to drop refs
 4. the editor is called by each route's drop refs handler to remove the associated TimeAxisView
 5. that TimeAxisView has already been destroyed in (2)


git-svn-id: svn://localhost/ardour2/branches/3.0@6392 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-12-23 00:33:03 +00:00
parent 682f2fc8ee
commit 24c0654fd5
1 changed files with 15 additions and 11 deletions

View File

@ -4824,6 +4824,13 @@ Editor::remove_route (TimeAxisView *tv)
ENSURE_GUI_THREAD (*this, &Editor::remove_route, tv)
TrackViewList::iterator i;
if ((i = find (track_views.begin(), track_views.end(), tv)) == track_views.end()) {
/* this track view has already been removed by someone else; e.g. when
* the session goes away, all TimeAxisViews are removed by the Editor's
* session_going_away handler.
*/
return;
}
boost::shared_ptr<Route> route;
RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (tv);
@ -4839,17 +4846,14 @@ Editor::remove_route (TimeAxisView *tv)
entered_track = 0;
}
if ((i = find (track_views.begin(), track_views.end(), tv)) != track_views.end()) {
i = track_views.erase (i);
if (track_views.empty()) {
next_tv = 0;
} else if (i == track_views.end()) {
next_tv = track_views.front();
} else {
next_tv = (*i);
}
i = track_views.erase (i);
if (track_views.empty()) {
next_tv = 0;
} else if (i == track_views.end()) {
next_tv = track_views.front();
} else {
next_tv = (*i);
}
if (current_mixer_strip && current_mixer_strip->route() == route) {