X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/50c06297bd2a5b496a899198a5957755655ab43d..c57e3bd53e52b819c2cb42cb3d5b222f3b6b495a:/src/common/sizer.cpp diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index f959eb34b2..36c63f9e10 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -388,7 +388,14 @@ void wxSizerItem::DeleteWindows() break; 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(); + //Putting this after the switch will result in a spacer + //not being deleted properly on destruction + m_kind = Item_None; break; case Item_Sizer: @@ -400,7 +407,6 @@ void wxSizerItem::DeleteWindows() wxFAIL_MSG( _T("unexpected wxSizerItem::m_kind") ); } - m_kind = Item_None; } void wxSizerItem::Show( bool show ) @@ -416,7 +422,7 @@ void wxSizerItem::Show( bool show ) break; case Item_Sizer: - m_sizer->ShowItems(show); + m_sizer->Show(show); break; case Item_Spacer: