X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/936f635341e9b92b37db93cc7781d564babbe25f..42dfe2b25975537db8bb54ab104385748ff7d175:/src/msw/statusbar.cpp?ds=inline diff --git a/src/msw/statusbar.cpp b/src/msw/statusbar.cpp index aef8e5c567..4baebc470b 100644 --- a/src/msw/statusbar.cpp +++ b/src/msw/statusbar.cpp @@ -125,11 +125,11 @@ bool wxStatusBar::Create(wxWindow *parent, // we must refresh the frame size when the statusbar is created, because // its client area might change - wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); - if ( frame ) - { - frame->SendSizeEvent(); - } + // + // notice that we must post the event, not send it, as the frame doesn't + // know that we're its status bar yet so laying it out right now wouldn't + // work correctly, we need to wait until we return to the main loop + PostSizeEventToParent(); return true; } @@ -139,11 +139,7 @@ wxStatusBar::~wxStatusBar() // we must refresh the frame size when the statusbar is deleted but the // frame is not - otherwise statusbar leaves a hole in the place it used to // occupy - wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); - if ( frame && !frame->IsBeingDeleted() ) - { - frame->SendSizeEvent(); - } + PostSizeEventToParent(); } void wxStatusBar::SetFieldsCount(int nFields, const int *widths)