prevent crash during track-deletion (un-selecting deleted tracks)
authorRobin Gareus <robin@gareus.org>
Thu, 10 Nov 2016 22:04:12 +0000 (23:04 +0100)
committerRobin Gareus <robin@gareus.org>
Thu, 10 Nov 2016 22:20:58 +0000 (23:20 +0100)
gtk2_ardour/editor_ops.cc
gtk2_ardour/route_processor_selection.cc
gtk2_ardour/route_processor_selection.h

index 803d3e07744755dc46144f781f5f12026c7cca86..3d7adc55849583aa17c872d9cf14737ee17235cb 100644 (file)
@@ -82,6 +82,7 @@
 #include "item_counts.h"
 #include "keyboard.h"
 #include "midi_region_view.h"
+#include "mixer_ui.h"
 #include "mixer_strip.h"
 #include "mouse_cursors.h"
 #include "normalize_dialog.h"
@@ -7360,6 +7361,9 @@ edit your ardour.rc file to set the\n\
                return;
        }
 
+
+       Mixer_UI::instance()->selection().block_routes_changed (true);
+       selection->block_tracks_changed (true);
        {
                DisplaySuspender ds;
                boost::shared_ptr<RouteList> rl (new RouteList);
@@ -7372,6 +7376,9 @@ edit your ardour.rc file to set the\n\
         * destructors are called,
         * diskstream drops references, save_state is called (again for every track)
         */
+       selection->block_tracks_changed (false);
+       Mixer_UI::instance()->selection().block_routes_changed (false);
+       selection->TracksChanged (); /* EMIT SIGNAL */
 }
 
 void
index 729032e637fde74e8df417b98261e329c85471c9..7428267b50b4d77d8d7398f10ca90d390a9ca77c 100644 (file)
@@ -32,8 +32,8 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
+unsigned int RouteProcessorSelection::_no_route_change_signal = 0;
 RouteProcessorSelection::RouteProcessorSelection()
-       : _no_route_change_signal (false)
 {
 }
 
@@ -76,7 +76,7 @@ RouteProcessorSelection::clear_routes ()
        }
        axes.clear ();
        drop_connections ();
-       if (!_no_route_change_signal) {
+       if (0 == _no_route_change_signal) {
                RoutesChanged ();
        }
 }
@@ -110,7 +110,7 @@ RouteProcessorSelection::add (AxisView* r)
                        ms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RouteProcessorSelection::remove, this, _1), gui_context());
                }
 
-               if (!_no_route_change_signal) {
+               if (0 == _no_route_change_signal) {
                        RoutesChanged();
                }
        }
@@ -125,7 +125,7 @@ RouteProcessorSelection::remove (AxisView* r)
        if ((i = find (axes.begin(), axes.end(), r)) != axes.end()) {
                (*i)->set_selected (false);
                axes.erase (i);
-               if (!_no_route_change_signal) {
+               if (0 == _no_route_change_signal) {
                        RoutesChanged ();
                }
        }
@@ -153,5 +153,10 @@ RouteProcessorSelection::empty ()
 void
 RouteProcessorSelection::block_routes_changed (bool yn)
 {
-       _no_route_change_signal = yn;
+       if (yn) {
+               ++_no_route_change_signal;
+       } else {
+               assert (_no_route_change_signal > 0);
+               --_no_route_change_signal;
+       }
 }
index 6c037d7bd9ef0aae777a2a6f25e911565834c18f..a4d6f0f1a49ba8cc184927316746a3c73f520ebd 100644 (file)
@@ -58,7 +58,7 @@ class RouteProcessorSelection : public PBD::ScopedConnectionList, public sigc::t
 
   private:
        void removed (AxisView*);
-       bool _no_route_change_signal;
+       static unsigned int _no_route_change_signal;
 
 };