fix bug with entries present in both global and local files (patch 773360)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@22927 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -607,8 +607,11 @@ void wxFileConfig::Parse(wxTextBuffer& buffer, bool bLocal)
|
||||
// will create it if doesn't yet exist
|
||||
SetPath(strGroup);
|
||||
|
||||
if ( bLocal )
|
||||
if ( bLocal ) {
|
||||
if (m_pCurrentGroup->Parent())
|
||||
m_pCurrentGroup->Parent()->SetLastGroup(m_pCurrentGroup);
|
||||
m_pCurrentGroup->SetLine(m_linesTail);
|
||||
}
|
||||
|
||||
// check that there is nothing except comments left on this line
|
||||
bool bCont = TRUE;
|
||||
@@ -663,17 +666,6 @@ void wxFileConfig::Parse(wxTextBuffer& buffer, bool bLocal)
|
||||
if ( pEntry == NULL ) {
|
||||
// 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);
|
||||
}
|
||||
else {
|
||||
if ( bLocal && pEntry->IsImmutable() ) {
|
||||
@@ -690,12 +682,14 @@ void wxFileConfig::Parse(wxTextBuffer& buffer, bool bLocal)
|
||||
else if ( !bLocal || pEntry->IsLocal() ) {
|
||||
wxLogWarning(_("file '%s', line %d: key '%s' was first found at line %d."),
|
||||
buffer.GetName(), n + 1, strKey.c_str(), pEntry->Line());
|
||||
|
||||
if ( bLocal )
|
||||
pEntry->SetLine(m_linesTail);
|
||||
// the value from the last duplicated key is the one that gets used
|
||||
}
|
||||
}
|
||||
|
||||
if ( bLocal )
|
||||
pEntry->SetLine(m_linesTail);
|
||||
|
||||
|
||||
// skip whitespace
|
||||
while ( wxIsspace(*pEnd) )
|
||||
pEnd++;
|
||||
@@ -1825,8 +1819,6 @@ void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser)
|
||||
else // this entry didn't exist in the local file
|
||||
{
|
||||
// add a new line to the file
|
||||
wxASSERT( m_nLine == wxNOT_FOUND ); // consistency check
|
||||
|
||||
wxFileConfigLineList *line = Group()->GetLastEntryLine();
|
||||
m_pLine = Group()->Config()->LineListInsert(strLine, line);
|
||||
|
||||
|
Reference in New Issue
Block a user