diff options
author | Robin Gareus <robin@gareus.org> | 2019-03-19 21:56:13 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-03-19 22:05:06 +0100 |
commit | 50604d83de43e71ccc3190400be2d8c89dbe6b4c (patch) | |
tree | 9796e126b02ef1362cba87e96d071f35b0ecaf76 /libs/ardour/session_playlists.cc | |
parent | c2e0fe8b3f2b07d8cc4abc0d873c98fca3bb4b9e (diff) |
Fix incorrectly saved un-used playlists
This addresses issues with session-cleanup and region-cleanup in
some sessions.
The root-cause why some unused playlists were saved in the session XML
under <Playlists> and not <UnusedPlaylists> is not known.
Early 6.0-pre did incorrect reference counting, but also older sessions
had this issue. Perhaps due to ambiguities of matching playlists
by name in 5.x or session-format changes 3.x .. 5.x.
Diffstat (limited to 'libs/ardour/session_playlists.cc')
-rw-r--r-- | libs/ardour/session_playlists.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libs/ardour/session_playlists.cc b/libs/ardour/session_playlists.cc index d0468b981e..4ee92d2649 100644 --- a/libs/ardour/session_playlists.cc +++ b/libs/ardour/session_playlists.cc @@ -111,6 +111,30 @@ SessionPlaylists::remove (boost::shared_ptr<Playlist> playlist) } } +void +SessionPlaylists::update_tracking () +{ + /* This is intended to be called during session-load, after loading + * playlists and re-assigning them to tracks (refcnt is up to date). + * Check playlist refcnt, move unused playlist to unused_playlists + * array (which may be the case when loading old sessions) + */ + for (List::iterator i = playlists.begin(); i != playlists.end(); ) { + if ((*i)->hidden () || (*i)->used ()) { + ++i; + continue; + } + + warning << _("Session State: Unused playlist was listed as used.") << endmsg; + + assert (unused_playlists.find (*i) == unused_playlists.end()); + unused_playlists.insert (*i); + + List::iterator rm = i; + ++i; + playlists.erase (rm); + } +} void SessionPlaylists::track (bool inuse, boost::weak_ptr<Playlist> wpl) |