]> git.saurik.com Git - wxWidgets.git/commitdiff
fix the bug with renaming groups leaving wxFileConfig in inconsistent state (closes...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 11 Nov 2006 22:11:01 +0000 (22:11 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 11 Nov 2006 22:11:01 +0000 (22:11 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43323 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/common/fileconf.cpp

index 8294e1a4ad843a715c4e25c56ce6914c4ca77818..cd5bb82d0591f0fa0a9ed05c14868f4e6dc9ca33 100644 (file)
@@ -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:
 
index cc4823e0588b88c46e153a51c5972d4d51d53f2e..8d67e3a4f76d072a2afa08405ed121a49c980890 100644 (file)
@@ -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();
 }