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:
@@ -61,6 +61,14 @@ wxStatusBarBase::~wxStatusBarBase()
|
|||||||
FreeWidths();
|
FreeWidths();
|
||||||
FreeStacks();
|
FreeStacks();
|
||||||
InitStyles();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -423,6 +423,14 @@ bool wxToolBarBase::Realize()
|
|||||||
wxToolBarBase::~wxToolBarBase()
|
wxToolBarBase::~wxToolBarBase()
|
||||||
{
|
{
|
||||||
WX_CLEAR_LIST(wxToolBarToolsList, m_tools);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user