clarify ownership and management of RouteUI::remote_control_menu
authorPaul Davis <paul@linuxaudiosystems.com>
Sun, 30 Nov 2008 23:15:49 +0000 (23:15 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Sun, 30 Nov 2008 23:15:49 +0000 (23:15 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4273 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/mixer_strip.cc
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_ui.cc

index 1b8ce06dda1626b74fe83500ce2c4729c789da93..d4f25d1896459d903d26965006558d66ababac93 100644 (file)
@@ -1056,11 +1056,10 @@ MixerStrip::build_route_ops_menu ()
        denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
        denormal_menu_item->set_active (_route->denormal_protection());
 
-       build_remote_control_menu ();
-       
-       items.push_back (SeparatorElem());
        if (!Profile->get_sae()) {
-              items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
+               build_remote_control_menu ();
+               items.push_back (SeparatorElem());
+               items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
         }
 
        items.push_back (SeparatorElem());
index aeb30b8a614340ecf8635edb10b2c46c55c4f82a..1a85ef0307faa310535b10a78adab7cb5805f9cc 100644 (file)
@@ -450,11 +450,10 @@ RouteTimeAxisView::build_display_menu ()
 
        items.push_back (SeparatorElem());
 
-       build_remote_control_menu ();
-       build_automation_action_menu ();
-
        if (!Profile->get_sae()) {
+               build_remote_control_menu ();
                items.push_back (MenuElem (_("Remote Control ID"), *remote_control_menu));
+               build_automation_action_menu ();
                items.push_back (MenuElem (_("Automation"), *automation_action_menu));
                items.push_back (SeparatorElem());
        }
index efec686ed5195a7a1fa70d711dcaffaaaf2f6d4a..cc4f5413855324142185e4b894daaf986e87244e 100644 (file)
@@ -114,11 +114,6 @@ RouteUI::reset ()
                mute_menu = 0;
        }
        
-       if (remote_control_menu) {
-               delete remote_control_menu;
-               remote_control_menu = 0;
-       }
-
        if (xml_node) {
                /* do not delete the node - its owned by the route */
                xml_node = 0;
@@ -193,6 +188,7 @@ RouteUI::set_route (boost::shared_ptr<Route> rp)
 RouteUI::~RouteUI()
 {
        GoingAway (); /* EMIT SIGNAL */
+
        if (solo_menu) {
                delete solo_menu;
        }
@@ -200,10 +196,13 @@ RouteUI::~RouteUI()
        if (mute_menu) {
                delete mute_menu;
        }
-
-       if (remote_control_menu) {
-               delete remote_control_menu;
-       }
+       
+       /* Note: the remote control menu is constructed
+          by derived classes (e.g. MixerStrip or RouteTimeAxis) and
+          is always attached to a context menu. It then becomes
+          owned by that menu, and will deleted along with it. We
+          do not need to take care of it here.
+       */
 }
 
 bool
@@ -941,7 +940,7 @@ gint
 RouteUI::idle_remove_this_route (RouteUI *rui)
 {
        rui->_session.remove_route (rui->_route);
-       return FALSE;
+       return false;
 }
 
 void