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
This commit is contained in:
Carl Hetherington 2011-12-12 02:17:17 +00:00
parent 748b24009b
commit 4dd7b9b34c
3 changed files with 21 additions and 1 deletions

View File

@ -2484,3 +2484,19 @@ RouteTimeAxisView::state_id() const
return string_compose ("rtav %1", _route->id().to_s());
}
void
RouteTimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> c)
{
TimeAxisView::remove_child (c);
boost::shared_ptr<AutomationTimeAxisView> a = boost::dynamic_pointer_cast<AutomationTimeAxisView> (c);
if (a) {
for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) {
if (i->second == a) {
_automation_tracks.erase (i);
return;
}
}
}
}

View File

@ -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<TimeAxisView>);
};
#endif /* __ardour_route_time_axis_h__ */

View File

@ -267,7 +267,7 @@ class TimeAxisView : public virtual AxisView
Children children;
bool is_child (TimeAxisView*);
void remove_child (boost::shared_ptr<TimeAxisView>);
virtual void remove_child (boost::shared_ptr<TimeAxisView>);
void add_child (boost::shared_ptr<TimeAxisView>);
/* selection display */