reset parent frame tool/status bar pointer automatically when the bar is destroyed; this ensures that we're never left with dangling pointers and fixes a crash under Mac when MDI child frame with a toolbar is closed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29923 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-10-16 20:25:39 +00:00
parent 15b0d04889
commit 2ab822146c
2 changed files with 16 additions and 0 deletions

View 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);
}
}
// ----------------------------------------------------------------------------

View 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);
}
}
// ----------------------------------------------------------------------------