From 5024483dd008a5a43cf5eb2e00e4cf1a8168ed91 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 20 May 2003 21:45:04 +0000 Subject: [PATCH] A fix to prevent mungeing of the config file after reading in entries (say, just one entry in one group), then adding entries to a different group. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/toback24.txt | 5 +++++ src/common/fileconf.cpp | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/docs/toback24.txt b/docs/toback24.txt index c653128fba..c4bc8320c0 100644 --- a/docs/toback24.txt +++ b/docs/toback24.txt @@ -173,3 +173,8 @@ This gets the tab size and adds a bit for borders. We should do the same for other platforms, only rationalise it so that wxNotebook returns the tab rect info. +19. Add wxFileConfig bug fix, marked by ... in Parse(). +This prevents mungeing of the config file after reading in +entries (say, just one entry in one group), then adding entries +to a different group. + diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 36537f99cf..3e39151ade 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -672,6 +672,16 @@ void wxFileConfig::Parse(wxTextBuffer& buffer, bool bLocal) // new entry pEntry = m_pCurrentGroup->AddEntry(strKey, n); + // + // Take the opportunity to set some pointers now + // that we know there are items in this group. + // Otherwise, items added to a newly read file + // can be put in the wrong place. + m_pCurrentGroup->SetLastEntry(pEntry); + if (m_pCurrentGroup->Parent()) + m_pCurrentGroup->Parent()->SetLastGroup(m_pCurrentGroup); + // + if ( bLocal ) pEntry->SetLine(m_linesTail); } -- 2.45.2