From: Vadim Zeitlin Date: Mon, 13 Aug 2001 14:59:08 +0000 (+0000) Subject: don't try to refresh the menu bar before showing it, fixes crash on startup with... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4087064a382ca938e9b7889a9aafd6340b54d6c5 don't try to refresh the menu bar before showing it, fixes crash on startup with wxGTK git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11366 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index ba08a02a6e..2bcfe84777 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -1682,6 +1682,12 @@ wxString wxMenuBar::GetLabelTop(size_t pos) const void wxMenuBar::RefreshAllItemsAfter(size_t pos) { + if ( !IsCreated() ) + { + // no need to refresh if nothing is shown yet + return; + } + wxRect rect = GetItemRect(pos); rect.width = GetClientSize().x - rect.x; RefreshRect(rect); @@ -1692,6 +1698,12 @@ void wxMenuBar::RefreshItem(size_t pos) wxCHECK_RET( pos != (size_t)-1, _T("invalid item in wxMenuBar::RefreshItem") ); + if ( !IsCreated() ) + { + // no need to refresh if nothing is shown yet + return; + } + RefreshRect(GetItemRect(pos)); } @@ -1760,6 +1772,7 @@ void wxMenuBar::DoDraw(wxControlRenderer *renderer) wxRect wxMenuBar::GetItemRect(size_t pos) const { wxASSERT_MSG( pos < GetCount(), _T("invalid menu bar item index") ); + wxASSERT_MSG( IsCreated(), _T("can't call this method yet") ); wxRect rect; rect.x =