diff --git a/docs/changes.txt b/docs/changes.txt index 8294e1a4ad..cd5bb82d05 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -81,6 +81,7 @@ Major new features in 2.8 release All: - wxArrayString::Alloc() now works as reserve() and doesn't clear array contents +- Fixed long standing bug in wxFileConfig groups renaming (Antti Koivisto) wxMSW: diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index cc4823e058..8d67e3a4f7 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -1547,8 +1547,17 @@ void wxFileConfigGroup::Rename(const wxString& newName) { wxCHECK_RET( m_pParent, _T("the root group can't be renamed") ); + if ( newName == m_strName ) + return; + + // we need to remove the group from the parent and it back under the new + // name to keep the parents array of subgroups alphabetically sorted + m_pParent->m_aSubgroups.Remove(this); + m_strName = newName; + m_pParent->m_aSubgroups.Add(this); + // update the group lines recursively UpdateGroupAndSubgroupsLines(); }