]> git.saurik.com Git - wxWidgets.git/commitdiff
don't try to refresh the menu bar before showing it, fixes crash on startup with...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 13 Aug 2001 14:59:08 +0000 (14:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 13 Aug 2001 14:59:08 +0000 (14:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11366 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/univ/menu.cpp

index ba08a02a6ed8257f0a1b77dfc084f5f003cb82fc..2bcfe84777a935b6f7d5b97af0c0d569395ad1bb 100644 (file)
@@ -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 =