diff --git a/Mixer.cpp b/Mixer.cpp index 0898ec4..abb0081 100644 --- a/Mixer.cpp +++ b/Mixer.cpp @@ -658,14 +658,11 @@ void Mixer::renameSource(Source *s, const std::string &newname) // tentative new name std::string tentativename = s->name(); - std::list others = session_->getNameList(); - others.remove(tentativename); - // try the given new name if valid if ( !newname.empty() ) tentativename = newname; - tentativename = BaseToolkit::uniqueName(tentativename, others); + tentativename = BaseToolkit::uniqueName(tentativename, session_->getNameList(s->id())); // ok to rename s->setName(tentativename); diff --git a/Session.cpp b/Session.cpp index 9338647..23ff798 100644 --- a/Session.cpp +++ b/Session.cpp @@ -287,12 +287,14 @@ SourceIdList Session::getIdList() const return ids(sources_); } -std::list Session::getNameList() const +std::list Session::getNameList(uint64_t exceptid) const { std::list namelist; - for( SourceList::const_iterator it = sources_.cbegin(); it != sources_.cend(); ++it) - namelist.push_back( (*it)->name() ); + for( SourceList::const_iterator it = sources_.cbegin(); it != sources_.cend(); ++it) { + if ( (*it)->id() != exceptid ) + namelist.push_back( (*it)->name() ); + } return namelist; } diff --git a/Session.h b/Session.h index fc48108..a1d710f 100644 --- a/Session.h +++ b/Session.h @@ -66,7 +66,7 @@ public: SourceList::iterator find (uint64_t id); SourceIdList getIdList() const; - std::list getNameList() const; + std::list getNameList(uint64_t exceptid=0) const; SourceList::iterator at (int index); int index (SourceList::iterator it) const;