X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/89c20ac15cdcff42502723c0b52ba0e37a8c6275..a80e5f9e5b9d3d79865a0140caa714fafcd3808c:/src/common/sizer.cpp diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index c34e516932..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; + } }