use state Session::StateProtector
authorRobin Gareus <robin@gareus.org>
Sat, 28 Jun 2014 19:36:13 +0000 (21:36 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 28 Jun 2014 20:02:20 +0000 (22:02 +0200)
gtk2_ardour/editor_ops.cc
libs/ardour/session.cc

index 96be9ed4a51737daf48c72751b88a4016a8c5e60..aa386e634057efe2d9dac5aa4d4ad9adb6d9a82e 100644 (file)
@@ -6565,8 +6565,11 @@ edit your ardour.rc file to set the\n\
                return;
        }
 
-       for (vector<boost::shared_ptr<Route> >::iterator x = routes.begin(); x != routes.end(); ++x) {
-               _session->remove_route (*x);
+       {
+               Session::StateProtector sp (_session);
+               for (vector<boost::shared_ptr<Route> >::iterator x = routes.begin(); x != routes.end(); ++x) {
+                       _session->remove_route (*x);
+               }
        }
 }
 
index b4ae76c1caaa84e3c16e06476098d6682cd1563c..3123b59c2c9750e11b7e5399a34217fd5112301e 100644 (file)
@@ -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<Track> (*i)) {
                        (*i)->set_track_number(++tn);