summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2012-06-01 15:19:30 +0000
committerCarl Hetherington <carl@carlh.net>2012-06-01 15:19:30 +0000
commit6930071cdbccf78f3871027991355a3fc524ba4b (patch)
tree64aee3d25986bcba825f960c3373e0bc046a9cb3 /libs/ardour
parent50aeca5fa5ff317f18fc7963d65f65dca5bad89f (diff)
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
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/playlist.h1
-rw-r--r--libs/ardour/playlist.cc10
-rw-r--r--libs/ardour/track.cc10
3 files changed, 20 insertions, 1 deletions
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index ee57ca1cf0..a64ebdd727 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -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;
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index 3b0528ed3b..8a19b1fceb 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -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
{
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc
index 9699558ff1..0ad59d1b31 100644
--- a/libs/ardour/track.cc
+++ b/libs/ardour/track.cc
@@ -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 */