13
0

Break shared_ptr cycle between Track and its

RecEnableControl.


git-svn-id: svn://localhost/ardour2/branches/3.0@12039 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-04-19 23:31:00 +00:00
parent 9d2873c9f0
commit 55ed8756bb
2 changed files with 14 additions and 5 deletions

View File

@ -207,7 +207,7 @@ class Track : public Route, public PublicDiskstream
void set_value (double);
double get_value (void) const;
boost::shared_ptr<Track> track;
boost::weak_ptr<Track> track;
};
virtual void set_state_part_two () = 0;

View File

@ -214,14 +214,23 @@ Track::RecEnableControl::RecEnableControl (boost::shared_ptr<Track> t)
void
Track::RecEnableControl::set_value (double val)
{
cerr << "Track " << track->name() << " rec-enable set to " << val << endl;
track->set_record_enabled (val >= 0.5 ? true : false, this);
boost::shared_ptr<Track> t = track.lock ();
if (!t) {
return;
}
t->set_record_enabled (val >= 0.5 ? true : false, this);
}
double
Track::RecEnableControl::get_value (void) const
Track::RecEnableControl::get_value () const
{
return (track->record_enabled() ? 1.0 : 0.0);
boost::shared_ptr<Track> t = track.lock ();
if (!t) {
return 0;
}
return (t->record_enabled() ? 1.0 : 0.0);
}
bool