no longer delete and recreate MonitorSection when it is removed/added to a Session
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 10 Dec 2018 23:41:59 +0000 (18:41 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 10 Dec 2018 23:41:59 +0000 (18:41 -0500)
gtk2_ardour/mixer_ui.cc
gtk2_ardour/monitor_section.cc

index a4cfe775f93e58b76b6f55af121e02c38fc2a6e4..37286e8e586660011270d877453df5ba72672870 100644 (file)
@@ -570,7 +570,7 @@ Mixer_UI::add_stripables (StripableList& slist)
                                                if (mnode) {
                                                        _monitor_section->tearoff().set_state (*mnode);
                                                }
-                                               
+
                                                set_monitor_action_sensitivity(true);
                                        }
 
@@ -2660,9 +2660,9 @@ void
 Mixer_UI::monitor_section_going_away ()
 {
        /* Set sensitivity based on existence of the monitor bus  */
-       
+
        set_monitor_action_sensitivity(false);
-       
+
        if (_monitor_section) {
 
                XMLNode* ui_node = Config->extra_xml(X_("UI"));
@@ -2684,8 +2684,6 @@ Mixer_UI::monitor_section_going_away ()
                monitor_section_detached ();
                out_packer.remove (_monitor_section->tearoff());
                _monitor_section->set_session (0);
-               delete _monitor_section;
-               _monitor_section = 0;
        }
 }
 
index 94a821c866e3fbaae597c028f028467d6922f623..201bd175e406ae72754f326c8c29e43240b7c0fa 100644 (file)
@@ -60,9 +60,6 @@ using namespace Gtkmm2ext;
 using namespace PBD;
 using namespace std;
 
-Glib::RefPtr<ActionGroup> MonitorSection::monitor_actions;
-Gtkmm2ext::Bindings* MonitorSection::bindings = 0;
-
 #define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale()))
 
 MonitorSection::MonitorSection (Session* s)
@@ -96,15 +93,13 @@ MonitorSection::MonitorSection (Session* s)
 
        Glib::RefPtr<Action> act;
 
-       if (!monitor_actions) {
-               register_actions ();
-               load_bindings ();
-       }
+       load_bindings ();
+       register_actions ();
+       set_data ("ardour-bindings", bindings);
+       bindings->associate ();
 
        channel_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL);
 
-       set_data ("ardour-bindings", bindings);
-
        _plugin_selector = new PluginSelector (PluginManager::instance());
        insert_box = new ProcessorBox (_session, boost::bind (&MonitorSection::plugin_selector, this), _rr_selection, 0);
        insert_box->set_no_show_all ();
@@ -622,6 +617,12 @@ MonitorSection::set_session (Session* s)
 
                populate_buttons ();
 
+               /* some actions may have been left in the wrong state from a
+                * previous monitor route that was then deleted
+                */
+               ActionManager::set_sensitive (monitor_actions, true);
+               ActionManager::set_sensitive (solo_actions, true);
+
        } else {
                /* no session */