X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1a83b9bd10b7d92520c202e6ed6cff2015f13315..4200d1f4164a82739e3e54f5a85f25910c8a8d1d:/src/common/statbar.cpp diff --git a/src/common/statbar.cpp b/src/common/statbar.cpp index 76278969ea..641a772927 100644 --- a/src/common/statbar.cpp +++ b/src/common/statbar.cpp @@ -29,6 +29,7 @@ #endif #ifndef WX_PRECOMP + #include "wx/frame.h" #include "wx/statusbr.h" #endif //WX_PRECOMP @@ -61,6 +62,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); + } } // ---------------------------------------------------------------------------- @@ -99,7 +108,7 @@ void wxStatusBarBase::SetFieldsCount(int number, const int *widths) { wxCHECK_RET( number > 0, _T("invalid field number in SetFieldsCount") ); - bool refresh = FALSE; + bool refresh = false; if ( number != m_nFields ) { @@ -152,7 +161,7 @@ void wxStatusBarBase::SetFieldsCount(int number, const int *widths) ReinitWidths(); - refresh = TRUE; + refresh = true; } //else: keep the old m_statusWidths if we had them @@ -161,7 +170,7 @@ void wxStatusBarBase::SetFieldsCount(int number, const int *widths) SetStatusWidths(number, widths); // already done from SetStatusWidths() - refresh = FALSE; + refresh = false; } if ( refresh )