fix for #5078 - not considering unused playlists when computing region use count
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 12 Nov 2012 15:50:38 +0000 (15:50 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 12 Nov 2012 15:50:38 +0000 (15:50 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@13452 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/session_playlists.cc

index ac3baf20081ae3f9faf0a1fd70af2689a68a52be..b2c4640880284bf0d83364fe0946265e383167b6 100644 (file)
@@ -252,7 +252,9 @@ SessionPlaylists::find_equivalent_playlist_regions (boost::shared_ptr<Region> re
                (*i)->get_region_list_equivalent_regions (region, result);
 }
 
-/** Return the number of playlists (not regions) that contain @a src */
+/** Return the number of playlists (not regions) that contain @a src
+ *  Important: this counts usage in both used and not-used playlists.
+ */
 uint32_t
 SessionPlaylists::source_use_count (boost::shared_ptr<const Source> src) const
 {
@@ -264,6 +266,14 @@ SessionPlaylists::source_use_count (boost::shared_ptr<const Source> src) const
                         break;
                 }
        }
+
+       for (List::const_iterator p = unused_playlists.begin(); p != unused_playlists.end(); ++p) {
+                if ((*p)->uses_source (src)) {
+                        ++count;
+                        break;
+                }
+       }
+
        return count;
 }