From 54d5f36311d041ce3d5fa3e6ed14fde30bcb70b7 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 28 Jun 2016 15:05:48 -0400 Subject: changes in logic used by source cleanup to avoid endless recursion in sessions with deeply nested/recursive compound regions. This also fixes some potentially dangerous cleanup logic related to two sources with the same name (but different paths) --- libs/ardour/playlist.cc | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'libs/ardour/playlist.cc') diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index eaee1c4326..7267ec8cdf 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1774,12 +1774,23 @@ Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shar **********************************************************************/ boost::shared_ptr -Playlist::region_list() { +Playlist::region_list() +{ RegionReadLock rlock (this); boost::shared_ptr rlist (new RegionList (regions.rlist ())); return rlist; } +void +Playlist::deep_sources (std::set >& sources) const +{ + RegionReadLock rlock (const_cast(this)); + + for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) { + (*i)->deep_sources (sources); + } +} + boost::shared_ptr Playlist::regions_at (framepos_t frame) { @@ -2659,12 +2670,12 @@ Playlist::nudge_after (framepos_t start, framecnt_t distance, bool forwards) } bool -Playlist::uses_source (boost::shared_ptr src) const +Playlist::uses_source (boost::shared_ptr src, bool shallow) const { RegionReadLock rlock (const_cast (this)); for (set >::const_iterator r = all_regions.begin(); r != all_regions.end(); ++r) { - if ((*r)->uses_source (src)) { + if ((*r)->uses_source (src, true)) { return true; } } @@ -2672,6 +2683,7 @@ Playlist::uses_source (boost::shared_ptr src) const return false; } + boost::shared_ptr Playlist::find_region (const ID& id) const { @@ -2936,25 +2948,6 @@ Playlist::has_region_at (framepos_t const p) const return (i != regions.end()); } -/** Remove any region that uses a given source */ -void -Playlist::remove_region_by_source (boost::shared_ptr s) -{ - RegionWriteLock rl (this); - - RegionList::iterator i = regions.begin(); - while (i != regions.end()) { - RegionList::iterator j = i; - ++j; - - if ((*i)->uses_source (s)) { - remove_region_internal (*i); - } - - i = j; - } -} - /** Look from a session frame time and find the start time of the next region * which is on the top layer of this playlist. * @param t Time to look from. -- cgit v1.2.3