++tmp;
DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for used playlist %1 ; pre-ref = %2\n", (*i)->name(), (*i).use_count()));
+ boost::shared_ptr<Playlist> keeper (*i);
(*i)->drop_references ();
i = tmp;
++tmp;
DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for unused playlist %1 ; pre-ref = %2\n", (*i)->name(), (*i).use_count()));
+ boost::shared_ptr<Playlist> keeper (*i);
(*i)->drop_references ();
i = tmp;
if (!existing) {
playlists.insert (playlists.begin(), playlist);
- playlist->InUse.connect (*this, boost::bind (&SessionPlaylists::track, this, _1, boost::weak_ptr<Playlist>(playlist)));
+ playlist->InUse.connect_same_thread (*this, boost::bind (&SessionPlaylists::track, this, _1, boost::weak_ptr<Playlist>(playlist)));
}
return existing;
return boost::shared_ptr<Playlist>();
}
+boost::shared_ptr<Playlist>
+SessionPlaylists::by_id (const PBD::ID& id)
+{
+ Glib::Mutex::Lock lm (lock);
+
+ for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
+ if ((*i)->id() == id) {
+ return* i;
+ }
+ }
+
+ for (List::iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) {
+ if ((*i)->id() == id) {
+ return* i;
+ }
+ }
+
+ return boost::shared_ptr<Playlist>();
+}
+
void
SessionPlaylists::unassigned (std::list<boost::shared_ptr<Playlist> > & list)
{
}
}
+void
+SessionPlaylists::destroy_region (boost::shared_ptr<Region> r)
+{
+ Glib::Mutex::Lock lm (lock);
+
+ for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
+ (*i)->destroy_region (r);
+ }
+
+ for (List::iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) {
+ (*i)->destroy_region (r);
+ }
+}
+
+
void
SessionPlaylists::find_equivalent_playlist_regions (boost::shared_ptr<Region> region, vector<boost::shared_ptr<Region> >& result)
{
XMLNode* child = node->add_child ("Playlists");
for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
if (!(*i)->hidden()) {
- if (!(*i)->empty()) {
- if (full_state) {
- child->add_child_nocopy ((*i)->get_state());
- } else {
- child->add_child_nocopy ((*i)->get_template());
- }
- }
- }
+ if (full_state) {
+ child->add_child_nocopy ((*i)->get_state());
+ } else {
+ child->add_child_nocopy ((*i)->get_template());
+ }
+ }
}
child = node->add_child ("UnusedPlaylists");
/* now delete any that were marked for deletion */
for (vector<boost::shared_ptr<Playlist> >::iterator x = playlists_tbd.begin(); x != playlists_tbd.end(); ++x) {
+ boost::shared_ptr<Playlist> keeper (*x);
(*x)->drop_references ();
}