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:
parent
44a5cf78d1
commit
bfd2d02b3e
1 changed files with 9 additions and 1 deletions
|
|
@ -407,7 +407,15 @@ wxGenericMDIChildFrame::~wxGenericMDIChildFrame()
|
|||
parent->WXRemoveChild(this);
|
||||
|
||||
#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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue