X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/326a37f1484ae04edd588728526876c4c784405c..adb61e4d0d1a68b6d79d68615e9dc947e8828e6d:/src/common/tbarbase.cpp diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 57daadc573..2d250e20d5 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -114,10 +114,6 @@ bool wxToolBarToolBase::SetLongHelp(const wxString& help) return true; } -wxToolBarToolBase::~wxToolBarToolBase() -{ -} - // ---------------------------------------------------------------------------- // wxToolBarBase adding/deleting items // ---------------------------------------------------------------------------- @@ -423,6 +419,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); + } } // ----------------------------------------------------------------------------