]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/statbar.cpp
Fix centering of top-level children of wxMDIParentFrame on Mac
[wxWidgets.git] / src / common / statbar.cpp
index 492573e98bda782672615aaa4453becefc7232c0..641a772927af4ece136833cd65742bc09a67f9b6 100644 (file)
@@ -29,6 +29,7 @@
 #endif
 
 #ifndef WX_PRECOMP
 #endif
 
 #ifndef WX_PRECOMP
+    #include "wx/frame.h"
     #include "wx/statusbr.h"
 #endif //WX_PRECOMP
 
     #include "wx/statusbr.h"
 #endif //WX_PRECOMP
 
@@ -61,6 +62,14 @@ wxStatusBarBase::~wxStatusBarBase()
     FreeWidths();
     FreeStacks();
     InitStyles();
     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);
+    }
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------