summaryrefslogtreecommitdiff
path: root/libs/ardour/playlist.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-06-28 15:05:48 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-06-28 15:05:56 -0400
commit54d5f36311d041ce3d5fa3e6ed14fde30bcb70b7 (patch)
tree8bb084f1feea765dd33de4ace30c0c1030da40fc /libs/ardour/playlist.cc
parentdbb26485df31bbf3bd0aeb83e3e01d42e25fbd07 (diff)
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)
Diffstat (limited to 'libs/ardour/playlist.cc')
-rw-r--r--libs/ardour/playlist.cc37
1 files changed, 15 insertions, 22 deletions
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<RegionList>
-Playlist::region_list() {
+Playlist::region_list()
+{
RegionReadLock rlock (this);
boost::shared_ptr<RegionList> rlist (new RegionList (regions.rlist ()));
return rlist;
}
+void
+Playlist::deep_sources (std::set<boost::shared_ptr<Source> >& sources) const
+{
+ RegionReadLock rlock (const_cast<Playlist*>(this));
+
+ for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) {
+ (*i)->deep_sources (sources);
+ }
+}
+
boost::shared_ptr<RegionList>
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<const Source> src) const
+Playlist::uses_source (boost::shared_ptr<const Source> src, bool shallow) const
{
RegionReadLock rlock (const_cast<Playlist*> (this));
for (set<boost::shared_ptr<Region> >::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<const Source> src) const
return false;
}
+
boost::shared_ptr<Region>
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<Source> 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.