summaryrefslogtreecommitdiff
path: root/libs/ardour/source.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-04-12 23:20:37 +0000
committerDavid Robillard <d@drobilla.net>2007-04-12 23:20:37 +0000
commit959a7909c1adca430a63f783fd16687242a7be3d (patch)
treeb5048c3cc1bbb60bb680472b97ebba6ebb92d72f /libs/ardour/source.cc
parent96ca08b9257e4048294cd1804a65d4ae6cd88814 (diff)
Merged with trunk R1705.
Synced .po files with trunk. Fixed more editor operations to be type agnostic (ie not audio only). git-svn-id: svn://localhost/ardour2/branches/midi@1709 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/source.cc')
-rw-r--r--libs/ardour/source.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/libs/ardour/source.cc b/libs/ardour/source.cc
index c4cf1156cd..86afe4cb8d 100644
--- a/libs/ardour/source.cc
+++ b/libs/ardour/source.cc
@@ -132,7 +132,17 @@ Source::update_length (jack_nframes_t pos, jack_nframes_t cnt)
void
Source::add_playlist (boost::shared_ptr<Playlist> pl)
{
- _playlists.insert (pl);
+ std::pair<PlaylistMap::iterator,bool> res;
+ std::pair<boost::shared_ptr<Playlist>, uint32_t> newpair (pl, 1);
+ Glib::Mutex::Lock lm (playlist_lock);
+
+ res = _playlists.insert (newpair);
+
+ if (!res.second) {
+ /* it already existed, bump count */
+ res.first->second++;
+ }
+
pl->GoingAway.connect (bind (mem_fun (*this, &Source::remove_playlist), boost::weak_ptr<Playlist> (pl)));
}
@@ -145,10 +155,15 @@ Source::remove_playlist (boost::weak_ptr<Playlist> wpl)
return;
}
- std::set<boost::shared_ptr<Playlist> >::iterator x;
+ PlaylistMap::iterator x;
+ Glib::Mutex::Lock lm (playlist_lock);
if ((x = _playlists.find (pl)) != _playlists.end()) {
- _playlists.erase (x);
+ if (x->second > 1) {
+ x->second--;
+ } else {
+ _playlists.erase (x);
+ }
}
}