fix bug with deleting and recreating entries in wxFileConfig (patch 1796866)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@48776 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -90,6 +90,10 @@ Major new features in 2.8 release
|
||||
2.8.6
|
||||
-----
|
||||
|
||||
All:
|
||||
|
||||
- Fixed another bug in wxFileConfig when deleting entries (Axel Gembe)
|
||||
|
||||
All (GUI):
|
||||
|
||||
- Added an optimization to UI updates on idle, by only updating when the window
|
||||
|
@@ -1825,29 +1825,21 @@ bool wxFileConfigGroup::DeleteEntry(const wxChar *szName)
|
||||
// our last entry is being deleted - find the last one which stays
|
||||
wxASSERT( m_pLine != NULL ); // if we have an entry with !NULL pLine...
|
||||
|
||||
// go back until we find another entry or reach the group's line
|
||||
// find the previous entry (if any)
|
||||
wxFileConfigEntry *pNewLast = NULL;
|
||||
size_t n, nEntries = m_aEntries.Count();
|
||||
wxFileConfigLineList *pl;
|
||||
for ( pl = pLine->Prev(); pl != m_pLine; pl = pl->Prev() ) {
|
||||
// is it our subgroup?
|
||||
for ( n = 0; (pNewLast == NULL) && (n < nEntries); n++ ) {
|
||||
if ( m_aEntries[n]->GetLine() == m_pLine )
|
||||
pNewLast = m_aEntries[n];
|
||||
}
|
||||
|
||||
if ( pNewLast != NULL ) // found?
|
||||
const wxFileConfigLineList * const
|
||||
pNewLastLine = m_pLastEntry->GetLine()->Prev();
|
||||
const size_t nEntries = m_aEntries.GetCount();
|
||||
for ( size_t n = 0; n < nEntries; n++ ) {
|
||||
if ( m_aEntries[n]->GetLine() == pNewLastLine ) {
|
||||
pNewLast = m_aEntries[n];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( pl == m_pLine ) {
|
||||
wxASSERT( !pNewLast ); // how comes it has the same line as we?
|
||||
|
||||
// we've reached the group line without finding any subgroups
|
||||
m_pLastEntry = NULL;
|
||||
}
|
||||
else
|
||||
m_pLastEntry = pNewLast;
|
||||
// pNewLast can be NULL here -- it's ok and can happen if we have no
|
||||
// entries left
|
||||
m_pLastEntry = pNewLast;
|
||||
}
|
||||
|
||||
m_pConfig->LineListRemove(pLine);
|
||||
|
Reference in New Issue
Block a user