From 2542b776c5128bee46528b4b6d6b342772594953 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 30 Nov 2008 23:15:49 +0000 Subject: clarify ownership and management of RouteUI::remote_control_menu git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4273 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/mixer_strip.cc | 7 +++---- gtk2_ardour/route_time_axis.cc | 5 ++--- gtk2_ardour/route_ui.cc | 19 +++++++++---------- 3 files changed, 14 insertions(+), 17 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 1b8ce06dda..d4f25d1896 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -1056,11 +1056,10 @@ MixerStrip::build_route_ops_menu () denormal_menu_item = dynamic_cast (&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()); diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index aeb30b8a61..1a85ef0307 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -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()); } diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index efec686ed5..cc4f541385 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -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 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 -- cgit v1.2.3