diff --git a/docs/changes.txt b/docs/changes.txt index a31c66cc36..4ab6f1dd5c 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -66,6 +66,7 @@ All: wxMSW: - Fix crash when using wxCHMHelpController() in 64 bit builds (Xlord2). +- Fix MDI menu display after failure to create a child frame (troelsk). wxOSX: diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 0793cd2ad1..514e4eedfe 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -910,7 +910,9 @@ wxMDIChildFrame::~wxMDIChildFrame() if ( !m_hWnd ) return; - GetMDIParent()->RemoveMDIChild(this); + wxMDIParentFrame * const parent = GetMDIParent(); + + parent->RemoveMDIChild(this); // will be destroyed by DestroyChildren() but reset them before calling it // to avoid using dangling pointers if a callback comes in the meanwhile @@ -925,6 +927,12 @@ wxMDIChildFrame::~wxMDIChildFrame() MDIRemoveWindowMenu(NULL, m_hMenu); + // MDIRemoveWindowMenu() doesn't update the MDI menu when called with NULL + // window, so do it ourselves. + MDISetMenu(parent->GetClientWindow(), + (HMENU)parent->MSWGetActiveMenu(), + GetMDIWindowMenu(parent)); + MSWDestroyWindow(); }