Fixed assert (and crash in debug) in wxFileConfigGroup::DeleteSubgroupByName

Backported from CVS head


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20005 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-04-06 12:19:23 +00:00
parent 98a67aa507
commit 09007b50a0
2 changed files with 6 additions and 4 deletions

View File

@@ -178,6 +178,7 @@ All:
- fixed wxLANGUAGE_CHINESE_TAIWAN to use zh_TW catalogs
- added missing wx/quantize.h to install
- improved wxScrolledWindow/sizer interaction
- fixed assert (and crash in debug) in wxFileConfigGroup::DeleteSubgroupByName
Unix (GUI):

View File

@@ -1512,13 +1512,17 @@ wxFileConfigGroup *wxFileConfigGroup::AddSubgroup(const wxString& strName)
bool wxFileConfigGroup::DeleteSubgroupByName(const wxChar *szName)
{
return DeleteSubgroup(FindSubgroup(szName));
wxFileConfigGroup * const pGroup = FindSubgroup(szName);
return pGroup ? DeleteSubgroup(pGroup) : FALSE;
}
// Delete the subgroup and remove all references to it from
// other data structures.
bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup)
{
wxCHECK_MSG( pGroup, FALSE, _T("deleting non existing group?") );
wxLogTrace( _T("wxFileConfig"),
_T("Deleting group '%s' from '%s'"),
pGroup->Name().c_str(),
@@ -1533,10 +1537,7 @@ bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup)
_T(" text: '%s'"),
((m_pLine) ? m_pLine->Text().c_str() : wxEmptyString) );
wxCHECK_MSG( pGroup != 0, FALSE, _T("deleting non existing group?") );
// delete all entries
size_t nCount = pGroup->m_aEntries.Count();
wxLogTrace(_T("wxFileConfig"),