13
0

Remove playlists from the session lists when they DropReferences. Should fix #4023.

git-svn-id: svn://localhost/ardour2/branches/3.0@9460 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-05-02 23:22:00 +00:00
parent f89c285bcc
commit fe2651ae5f
2 changed files with 13 additions and 0 deletions

View File

@ -64,6 +64,7 @@ private:
bool add (boost::shared_ptr<Playlist>);
void remove (boost::shared_ptr<Playlist>);
void remove_weak (boost::weak_ptr<Playlist>);
void track (bool, boost::weak_ptr<Playlist>);
uint32_t n_playlists() const;

View File

@ -78,11 +78,23 @@ SessionPlaylists::add (boost::shared_ptr<Playlist> playlist)
if (!existing) {
playlists.insert (playlists.begin(), playlist);
playlist->InUse.connect_same_thread (*this, boost::bind (&SessionPlaylists::track, this, _1, boost::weak_ptr<Playlist>(playlist)));
playlist->DropReferences.connect_same_thread (
*this, boost::bind (&SessionPlaylists::remove_weak, this, boost::weak_ptr<Playlist> (playlist))
);
}
return existing;
}
void
SessionPlaylists::remove_weak (boost::weak_ptr<Playlist> playlist)
{
boost::shared_ptr<Playlist> p = playlist.lock ();
if (p) {
remove (p);
}
}
void
SessionPlaylists::remove (boost::shared_ptr<Playlist> playlist)
{