Reset the parent MDI menu after destroying MDI child in wxMSW
This is necessary to avoid menu corruption in case the child creation fails. Closes #17315.
This commit is contained in:
committed by
Vadim Zeitlin
parent
2ae17ee168
commit
bc6eba6043
@@ -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:
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user