final (?) fix for editor mixer strip handling when route is removed
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 11 Mar 2009 17:57:18 +0000 (17:57 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 11 Mar 2009 17:57:18 +0000 (17:57 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4791 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor_route_list.cc
gtk2_ardour/mixer_strip.cc
gtk2_ardour/route_ui.cc
gtk2_ardour/route_ui.h

index d889348ef704850b6a6a8edba1d47fb8c8683f3e..5a901db6c646bcf929181b0a3f0061d1e6e71ec1 100644 (file)
@@ -82,7 +82,6 @@ Editor::handle_new_route (Session::RouteList& routes)
                }
 
                route->gui_changed.connect (mem_fun(*this, &Editor::handle_gui_changes));
-               cerr << "Connect to GA for " << tv << " named " << tv->name() << endl;
                tv->GoingAway.connect (bind (mem_fun(*this, &Editor::remove_route), tv));
        }
 
@@ -160,21 +159,15 @@ Editor::remove_route (TimeAxisView *tv)
 
        if (current_mixer_strip->route() == route) {
 
-               cerr << "CMS is the one being deleted\n";
-               
                if (next_tv) {
-                       cerr << "move to " << next_tv->name() << endl;
                        set_selected_mixer_strip (*next_tv);
                } else {
-                       cerr << "no next TV, hide editor mixer strip\n";
-                       /* make the editor mixer strip go away setting the
+                       /* make the editor mixer strip go away by setting the
                         * button to inactive (which also unticks the menu option)
                         */
                        
                        ActionManager::uncheck_toggleaction ("<Actions>/Editor/show-editor-mixer");
                }
-       } else {
-               cerr << "CMS differs from the deleted one\n";
        }
 }
 
index b3a73010b18e98fe0cbe3f0c5cde497c0e5d8c3d..7287e6fb1608a107ddf0029ec29d6bc1a267c08b 100644 (file)
@@ -102,6 +102,14 @@ MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, bool in_mixer)
 
 {
        init ();
+
+       if (!_mixer_owned) {
+               /* the editor mixer strip: don't destroy it every time
+                  the underlying route goes away.
+               */
+
+               self_destruct = false;
+       }
 }
 
 MixerStrip::MixerStrip (Mixer_UI& mx, Session& sess, boost::shared_ptr<Route> rt, bool in_mixer)
@@ -1177,16 +1185,16 @@ MixerStrip::width_clicked ()
 void
 MixerStrip::hide_clicked ()
 {
-    // LAME fix to reset the button status for when it is redisplayed (part 1)
-    hide_button.set_sensitive(false);
-    
+       // LAME fix to reset the button status for when it is redisplayed (part 1)
+       hide_button.set_sensitive(false);
+       
        if (_embedded) {
-                Hiding(); /* EMIT_SIGNAL */
+               Hiding(); /* EMIT_SIGNAL */
        } else {
                _mixer.hide_strip (this);
        }
        
-    // (part 2)
+       // (part 2)
        hide_button.set_sensitive(true);
 }
 
index c45aed5c6c71eb37f67f68cbe5c85b61d3b9b10e..6cbb5290d47ca98e02e479c17579aa69644b00e3 100644 (file)
@@ -70,6 +70,7 @@ RouteUI::RouteUI (boost::shared_ptr<ARDOUR::Route> rt,
 void
 RouteUI::init ()
 {
+       self_destruct = true;
        xml_node = 0;
        mute_menu = 0;
        solo_menu = 0;
@@ -149,7 +150,9 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
           up when the route is destroyed.
        */
 
-       new PairedShiva<Route,RouteUI> (*_route, *this);
+       if (self_destruct) {
+               new PairedShiva<Route,RouteUI> (*_route, *this);
+       }
 
        mute_button->set_controllable (&_route->mute_control());
        mute_button->set_label (m_name);
@@ -189,7 +192,9 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
 
 RouteUI::~RouteUI()
 {
-       GoingAway (); /* EMIT SIGNAL */
+       /* derived classes should emit GoingAway so that they receive the signal
+          when the object is still a legal derived instance.
+        */
 
        if (solo_menu) {
                delete solo_menu;
index a4bfda2d8e9147b0b41a542f62a78d542a5e0c33..f58c8f4fe94d8df7e91521b16f4f909521f2c73e 100644 (file)
@@ -170,6 +170,8 @@ class RouteUI : public virtual AxisView
        std::string m_name;
        std::string r_name;
 
+       bool self_destruct; 
+
        void init ();
        void reset ();