From 4dd7b9b34ca74342442dfb2490f7a7080fe03142 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 12 Dec 2011 02:17:17 +0000 Subject: [PATCH] Make TimeAxisView::remove_child virtual so that RouteTimeAxis can override it to also remove the same child from its _automation_tracks list. Prevents a shared_ptr to an out-of-date AutomationTimeAxisView hanging around; fixes #4554. git-svn-id: svn://localhost/ardour2/branches/3.0@10985 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/route_time_axis.cc | 16 ++++++++++++++++ gtk2_ardour/route_time_axis.h | 4 ++++ gtk2_ardour/time_axis_view.h | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index a19ec1339f..4feafd5667 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -2484,3 +2484,19 @@ RouteTimeAxisView::state_id() const return string_compose ("rtav %1", _route->id().to_s()); } + +void +RouteTimeAxisView::remove_child (boost::shared_ptr c) +{ + TimeAxisView::remove_child (c); + + boost::shared_ptr a = boost::dynamic_pointer_cast (c); + if (a) { + for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) { + if (i->second == a) { + _automation_tracks.erase (i); + return; + } + } + } +} diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index da64b23498..eb1a212d0e 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -306,6 +306,10 @@ protected: UnderlayMirrorList _underlay_mirrors; bool _ignore_track_mode_change; ///< true to ignore track mode change signals + +private: + + void remove_child (boost::shared_ptr); }; #endif /* __ardour_route_time_axis_h__ */ diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index 790274c626..9771c8b200 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -267,7 +267,7 @@ class TimeAxisView : public virtual AxisView Children children; bool is_child (TimeAxisView*); - void remove_child (boost::shared_ptr); + virtual void remove_child (boost::shared_ptr); void add_child (boost::shared_ptr); /* selection display */