X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/222ed1d678dff2f5c3c4164321dd05e8f47de487..a80e5f9e5b9d3d79865a0140caa714fafcd3808c:/src/common/sizer.cpp diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 3f7e4352a6..3650a7b5b7 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -94,10 +94,16 @@ wxSizerItem::wxSizerItem( wxSizer *sizer, int proportion, int flag, int border, wxSizerItem::~wxSizerItem() { - if (m_userData) - delete m_userData; - if (m_sizer) + delete m_userData; + + if ( m_window ) + { + m_window->SetContainingSizer(NULL); + } + else // we must be a sizer + { delete m_sizer; + } } @@ -434,6 +440,7 @@ bool wxSizer::Detach( wxSizer *sizer ) if (item->GetSizer() == sizer) { item->DetachSizer(); + delete item; m_children.Erase( node ); return true; } @@ -455,6 +462,7 @@ bool wxSizer::Detach( wxWindow *window ) if (item->GetWindow() == window) { item->GetWindow()->SetContainingSizer( NULL ); + delete item; m_children.Erase( node ); return true; } @@ -481,6 +489,7 @@ bool wxSizer::Detach( int index ) else if( item->IsWindow() ) item->GetWindow()->SetContainingSizer( NULL ); + delete item; m_children.Erase( node ); return true; }