X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d775fa82354a1f8d5db87ad1d71ab00ef7d9123c..0bba37f51ded370ee79e26916c4c94ce5dc1f44e:/src/common/statbar.cpp?ds=sidebyside diff --git a/src/common/statbar.cpp b/src/common/statbar.cpp index 492573e98b..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); + } } // ----------------------------------------------------------------------------