diff options
author | David Robillard <d@drobilla.net> | 2007-01-09 23:24:54 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-01-09 23:24:54 +0000 |
commit | 532f6aad4ac79ca15d69deccd18fca90e444c437 (patch) | |
tree | 0d4ca5449af8eb48ad56e163efcab42c4656e8de /libs/ardour/source.cc | |
parent | ef6b25432d9c46d71b08c0f7d5f2686df428c4e8 (diff) |
Merged with trunk R1283.
NOTE: Compiles, but broken (crash on adding MIDI track).
git-svn-id: svn://localhost/ardour2/branches/midi@1292 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 8f0afd3507..db2147493a 100644 --- a/libs/ardour/source.cc +++ b/libs/ardour/source.cc @@ -131,15 +131,22 @@ Source::update_length (jack_nframes_t pos, jack_nframes_t cnt) } 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); |