remove debug output and add a few suggestive comments
[ardour.git] / libs / ardour / playlist.cc
index 7267ec8cdf8a02f067eb2e8314599e68e2aae0b7..58405e4755747be9c7b188a305413fd64162f1ba 100644 (file)
@@ -2675,7 +2675,13 @@ 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, true)) {
+               /* Note: passing the second argument as false can cause at best
+                  incredibly deep and time-consuming recursion, and at worst
+                  cycles if the user has managed to create cycles of reference
+                  between compound regions. We generally only this during
+                  cleanup, and @param shallow is passed as true.
+               */
+               if ((*r)->uses_source (src, shallow)) {
                        return true;
                }
        }