Fix memory leak when a spacer is added, and crash when a window is added before wxSizerItem::DeleteWindows
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33383 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -388,7 +388,14 @@ void wxSizerItem::DeleteWindows()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Item_Window:
|
case Item_Window:
|
||||||
|
//We are deleting the window from this sizer - normally
|
||||||
|
//the window destroys the sizer associated with it,
|
||||||
|
//which might destroy this, which we don't want
|
||||||
|
m_window->SetContainingSizer(NULL);
|
||||||
m_window->Destroy();
|
m_window->Destroy();
|
||||||
|
//Putting this after the switch will result in a spacer
|
||||||
|
//not being deleted properly on destruction
|
||||||
|
m_kind = Item_None;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Item_Sizer:
|
case Item_Sizer:
|
||||||
@@ -400,7 +407,6 @@ void wxSizerItem::DeleteWindows()
|
|||||||
wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
|
wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_kind = Item_None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSizerItem::Show( bool show )
|
void wxSizerItem::Show( bool show )
|
||||||
|
Reference in New Issue
Block a user