diff --git a/src/generic/mdig.cpp b/src/generic/mdig.cpp index b56b4896b1..b3f27225a2 100644 --- a/src/generic/mdig.cpp +++ b/src/generic/mdig.cpp @@ -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 }