When we rename a track, only rename its playlist if it
has never contained any regions (#4759). git-svn-id: svn://localhost/ardour2/branches/3.0@12525 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
50aeca5fa5
commit
6930071cdb
|
@ -118,6 +118,7 @@ public:
|
|||
bool hidden() const { return _hidden; }
|
||||
bool empty() const;
|
||||
uint32_t n_regions() const;
|
||||
bool all_regions_empty() const;
|
||||
std::pair<framepos_t, framepos_t> get_extent () const;
|
||||
layer_t top_layer() const;
|
||||
|
||||
|
|
|
@ -2180,6 +2180,16 @@ Playlist::n_regions() const
|
|||
return regions.size();
|
||||
}
|
||||
|
||||
/** @return true if the all_regions list is empty, ie this playlist
|
||||
* has never had a region added to it.
|
||||
*/
|
||||
bool
|
||||
Playlist::all_regions_empty() const
|
||||
{
|
||||
RegionReadLock rl (const_cast<Playlist *> (this));
|
||||
return all_regions.empty();
|
||||
}
|
||||
|
||||
pair<framepos_t, framepos_t>
|
||||
Playlist::get_extent () const
|
||||
{
|
||||
|
|
|
@ -329,7 +329,15 @@ Track::set_name (const string& str)
|
|||
return false;
|
||||
}
|
||||
|
||||
_diskstream->set_name (str);
|
||||
if (_diskstream->playlist()->all_regions_empty ()) {
|
||||
/* Only rename the diskstream (and therefore the playlist) if
|
||||
the playlist has never had a region added to it. Otherwise
|
||||
people can get confused if, say, they have notes about a
|
||||
playlist with a given name and then it changes (see mantis
|
||||
#4759).
|
||||
*/
|
||||
_diskstream->set_name (str);
|
||||
}
|
||||
|
||||
/* save state so that the statefile fully reflects any filename changes */
|
||||
|
||||
|
|
Loading…
Reference in New Issue