diff options
Diffstat (limited to 'libs/ardour/session_playlists.cc')
-rw-r--r-- | libs/ardour/session_playlists.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/ardour/session_playlists.cc b/libs/ardour/session_playlists.cc index 1e5a276ad4..b4f85aa1a0 100644 --- a/libs/ardour/session_playlists.cc +++ b/libs/ardour/session_playlists.cc @@ -78,12 +78,24 @@ 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) { Glib::Mutex::Lock lm (lock); |