Fix crash in wxUniv when destroying MDI child frame
Disassociate child frame menu bar from its parent before destroying it to avoid using a dangling pointer later, when destroying the parent. See https://github.com/wxWidgets/wxWidgets/pull/2505 Closes #19253.
This commit is contained in:
@@ -407,7 +407,15 @@ wxGenericMDIChildFrame::~wxGenericMDIChildFrame()
|
|||||||
parent->WXRemoveChild(this);
|
parent->WXRemoveChild(this);
|
||||||
|
|
||||||
#if wxUSE_MENUS
|
#if wxUSE_MENUS
|
||||||
delete m_pMenuBar;
|
if ( m_pMenuBar )
|
||||||
|
{
|
||||||
|
// calling WXRemoveChild() above broke the link between the menu bar
|
||||||
|
// and the parent, so we need to also remove it explicitly
|
||||||
|
if ( parent )
|
||||||
|
parent->RemoveChild(m_pMenuBar);
|
||||||
|
|
||||||
|
delete m_pMenuBar;
|
||||||
|
}
|
||||||
#endif // wxUSE_MENUS
|
#endif // wxUSE_MENUS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user