diff options
author | Carl Hetherington <carl@carlh.net> | 2012-04-19 23:31:00 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-04-19 23:31:00 +0000 |
commit | 55ed8756bbf38a9f2f7bb73ea40172474fd174ea (patch) | |
tree | 9dba65401b671a2234dcef33466a646f586bb0ee /libs | |
parent | 9d2873c9f0b09cbb0ccbd5472beb4b03b03bb951 (diff) |
Break shared_ptr cycle between Track and its
RecEnableControl.
git-svn-id: svn://localhost/ardour2/branches/3.0@12039 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/track.h | 2 | ||||
-rw-r--r-- | libs/ardour/track.cc | 17 |
2 files changed, 14 insertions, 5 deletions
diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 99d9e3783a..6d2d73519c 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -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; diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index f5aba1e8a0..c2750ccf98 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -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 |