Fix wxFileConf crash demonstrated by the 'DeleteLastGroup'
unit test. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32940 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -543,6 +543,7 @@ wxFileConfig::wxFileConfig(wxInputStream &inStream, wxMBConv& conv)
|
|||||||
Parse(memText, true /* local */);
|
Parse(memText, true /* local */);
|
||||||
|
|
||||||
SetRootPath();
|
SetRootPath();
|
||||||
|
ResetDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_STREAMS
|
#endif // wxUSE_STREAMS
|
||||||
@@ -587,7 +588,7 @@ void wxFileConfig::Parse(wxTextBuffer& buffer, bool bLocal)
|
|||||||
{
|
{
|
||||||
LineListAppend(strLine);
|
LineListAppend(strLine);
|
||||||
|
|
||||||
// let the root group have it start line as well
|
// let the root group have its start line as well
|
||||||
if ( !n )
|
if ( !n )
|
||||||
{
|
{
|
||||||
m_pCurrentGroup->SetLine(m_linesTail);
|
m_pCurrentGroup->SetLine(m_linesTail);
|
||||||
@@ -1256,6 +1257,9 @@ void wxFileConfig::LineListRemove(wxFileConfigLineList *pLine)
|
|||||||
else
|
else
|
||||||
pNext->SetPrev(pPrev);
|
pNext->SetPrev(pPrev);
|
||||||
|
|
||||||
|
if ( m_pRootGroup->GetGroupLine() == pLine )
|
||||||
|
m_pRootGroup->SetLine(m_linesHead);
|
||||||
|
|
||||||
wxLogTrace( FILECONF_TRACE_MASK,
|
wxLogTrace( FILECONF_TRACE_MASK,
|
||||||
_T(" head: %s"),
|
_T(" head: %s"),
|
||||||
((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) );
|
((m_linesHead) ? m_linesHead->Text().c_str() : wxEmptyString) );
|
||||||
@@ -1315,7 +1319,8 @@ wxFileConfigGroup::~wxFileConfigGroup()
|
|||||||
|
|
||||||
void wxFileConfigGroup::SetLine(wxFileConfigLineList *pLine)
|
void wxFileConfigGroup::SetLine(wxFileConfigLineList *pLine)
|
||||||
{
|
{
|
||||||
wxASSERT( m_pLine == 0 ); // shouldn't be called twice
|
// shouldn't be called twice unless we are resetting the line
|
||||||
|
wxASSERT( m_pLine == 0 || pLine == 0 );
|
||||||
m_pLine = pLine;
|
m_pLine = pLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user