diff --git a/src/common/statbar.cpp b/src/common/statbar.cpp index 492573e98b..1a0b98a561 100644 --- a/src/common/statbar.cpp +++ b/src/common/statbar.cpp @@ -61,6 +61,14 @@ wxStatusBarBase::~wxStatusBarBase() FreeWidths(); FreeStacks(); InitStyles(); + + // notify the frame that it doesn't have a status bar any longer to avoid + // dangling pointers + wxFrameBase *frame = wxDynamicCast(GetParent(), wxFrameBase); + if ( frame && frame->GetStatusBar() == this ) + { + frame->SetStatusBar(NULL); + } } // ---------------------------------------------------------------------------- diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 57daadc573..0bd33adcaf 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -423,6 +423,14 @@ bool wxToolBarBase::Realize() wxToolBarBase::~wxToolBarBase() { WX_CLEAR_LIST(wxToolBarToolsList, m_tools); + + // notify the frame that it doesn't have a tool bar any longer to avoid + // dangling pointers + wxFrameBase *frame = wxDynamicCast(GetParent(), wxFrameBase); + if ( frame && frame->GetToolBar() == this ) + { + frame->SetToolBar(NULL); + } } // ----------------------------------------------------------------------------