X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b4da05a6388747cc8384fa6c8276c79c77b56946..f5ba273ecd799f652736ce2bc830283787302a56:/src/gtk/menu.cpp diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 573be47fd8..3aff75731f 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -317,6 +317,9 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) if ( !GtkAppend(menu, title) ) return FALSE; + if (pos+1 >= m_menus.GetCount()) + return TRUE; + GtkMenuShell *menu_shell = GTK_MENU_SHELL(m_factory->widget); gpointer data = g_list_last(menu_shell->children)->data; menu_shell->children = g_list_remove(menu_shell->children, data); @@ -335,9 +338,6 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) { - if ( !wxMenuBarBase::Replace(pos, menu, title) ) - return (wxMenu*) NULL; - // remove the old item and insert a new one wxMenu *menuOld = Remove(pos); if ( menuOld && !Insert(pos, menu, title) )