]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/tbarbase.cpp
set background style to wxBG_STYLE_COLOUR in SetBackgroundColour()
[wxWidgets.git] / src / common / tbarbase.cpp
index 57daadc5735e0643eb10b758c4988d4f27c0ed75..2d250e20d5b672f29428e5bb42fc6029b4e7d791 100644 (file)
@@ -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);
+    }
 }
 
 // ----------------------------------------------------------------------------