Fix replacing "Window" menu in wxMDIParentFrame in wxMSW.

When setting a new "Window" menu (as opposed to just modifying the existing
one which did work correctly), we shouldn't show it immediately in the menu
bar if there are no MDI children, this results in wrong UI and assert
failures.

Closes #15663.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75244 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-11-18 14:21:02 +00:00
parent 3a0c0dac4c
commit 1633eb4ac3

View File

@@ -374,15 +374,19 @@ void wxMDIParentFrame::SetWindowMenu(wxMenu* menu)
{
if ( menu != m_windowMenu )
{
// notice that Remove/AddWindowMenu() are safe to call even when
// m_windowMenu is NULL
RemoveWindowMenu();
// We may not be showing the window menu currently if we don't have any
// children, and in this case we shouldn't remove/add it back right now.
const bool hasWindowMenu = GetActiveChild() != NULL;
if ( hasWindowMenu )
RemoveWindowMenu();
delete m_windowMenu;
m_windowMenu = menu;
AddWindowMenu();
if ( hasWindowMenu )
AddWindowMenu();
}
#if wxUSE_ACCEL