]> git.saurik.com Git - wxWidgets.git/commitdiff
reset parent frame tool/status bar pointer automatically when the bar is destroyed...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 16 Oct 2004 20:25:39 +0000 (20:25 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 16 Oct 2004 20:25:39 +0000 (20:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29923 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/statbar.cpp
src/common/tbarbase.cpp

index 492573e98bda782672615aaa4453becefc7232c0..1a0b98a5613cece9f24ffc296b7a104ad439a285 100644 (file)
@@ -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);
+    }
 }
 
 // ----------------------------------------------------------------------------
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);
+    }
 }
 
 // ----------------------------------------------------------------------------