]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/tbarbase.cpp
First step at moving the print (dialog) native
[wxWidgets.git] / src / common / tbarbase.cpp
index 57daadc5735e0643eb10b758c4988d4f27c0ed75..0bd33adcafb9e289f214803f6e626c7dbd16204e 100644 (file)
@@ -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);
+    }
 }
 
 // ----------------------------------------------------------------------------