From: David Elliott Date: Tue, 20 Jan 2004 02:57:06 +0000 (+0000) Subject: When inserting a new menu don't try to find th eposition of the current one X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3d27b5746f360ea930bd1046fd61b1b27440ba7b When inserting a new menu don't try to find th eposition of the current one if the menubar is not yet attached. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25256 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index 4be9908fcc..478048e703 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -977,7 +977,8 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) { // Find out which MSW item before which we'll be inserting before // wxMenuBarBase::Insert is called and GetMenu(pos) is the new menu. - int mswpos = (pos == m_menus.GetCount()) + // If IsAttached() is false this won't be used anyway + int mswpos = (!IsAttached() || (pos == m_menus.GetCount())) ? -1 // append the menu : MSWPositionForWxMenu(GetMenu(pos),pos);