diff options
author | Carl Hetherington <carl@carlh.net> | 2009-12-23 00:33:03 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-12-23 00:33:03 +0000 |
commit | 24c0654fd5ec04066f139f9684496f5fe2ed9422 (patch) | |
tree | 0b6ddcfd563bb25014115d4d402a522a9d19ff63 /gtk2_ardour | |
parent | 682f2fc8ee154f62c6881560fc4c7bbac9e2eb98 (diff) |
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
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor.cc | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index c38a1995d4..320642cbd9 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -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) { |