diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-12-14 14:15:43 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-12-14 14:15:43 +0000 |
commit | af12adb34f62dc82f694a03ea3b2a6c99ba426ef (patch) | |
tree | 263ecb66462ee561c9e3741799541f0233f82e21 /libs/ardour/source.cc | |
parent | c0924280e9be867253a1b93eb7274e0eb955de5f (diff) |
use shared_ptr for all Playlist handling; cleanup works again
git-svn-id: svn://localhost/ardour2/trunk@1209 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/source.cc')
-rw-r--r-- | libs/ardour/source.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc index 74ca0afcd4..39a83cb6de 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -110,15 +110,22 @@ Source::set_state (const XMLNode& node) } void -Source::add_playlist (Playlist* pl) +Source::add_playlist (boost::shared_ptr<Playlist> pl) { _playlists.insert (pl); + pl->GoingAway.connect (bind (mem_fun (*this, &Source::remove_playlist), boost::weak_ptr<Playlist> (pl))); } void -Source::remove_playlist (Playlist* pl) +Source::remove_playlist (boost::weak_ptr<Playlist> wpl) { - std::set<Playlist*>::iterator x; + boost::shared_ptr<Playlist> pl (wpl.lock()); + + if (!pl) { + return; + } + + std::set<boost::shared_ptr<Playlist> >::iterator x; if ((x = _playlists.find (pl)) != _playlists.end()) { _playlists.erase (x); |