diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 96be9ed4a5..aa386e6340 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -6565,8 +6565,11 @@ edit your ardour.rc file to set the\n\ return; } - for (vector >::iterator x = routes.begin(); x != routes.end(); ++x) { - _session->remove_route (*x); + { + Session::StateProtector sp (_session); + for (vector >::iterator x = routes.begin(); x != routes.end(); ++x) { + _session->remove_route (*x); + } } } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index b4ae76c1ca..3123b59c2c 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1882,6 +1882,7 @@ Session::new_midi_track (const ChanCount& input, const ChanCount& output, boost: failed: if (!new_routes.empty()) { + StateProtector sp (this); add_routes (new_routes, true, true, true); if (instrument) { @@ -2123,6 +2124,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod failed: if (!new_routes.empty()) { + StateProtector sp (this); add_routes (new_routes, true, true, true); } @@ -2208,6 +2210,7 @@ Session::new_audio_route (int input_channels, int output_channels, RouteGroup* r failure: if (!ret.empty()) { + StateProtector sp (this); add_routes (ret, false, true, true); // autoconnect outputs only } @@ -2324,6 +2327,7 @@ Session::new_route_from_template (uint32_t how_many, const std::string& template out: if (!ret.empty()) { + StateProtector sp (this); add_routes (ret, true, true, true); IO::enable_connecting (); } @@ -3059,6 +3063,8 @@ Session::reassign_track_numbers () SignalOrderRouteSorter sorter; r.sort (sorter); + StateProtector sp (this); + for (RouteList::iterator i = r.begin(); i != r.end(); ++i) { if (boost::dynamic_pointer_cast (*i)) { (*i)->set_track_number(++tn);