X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1987af7e9f5685198b0c19e2326eebf7e56b7834..61f0d452ea7e47fea18d0ab748095dc42d7dd66d:/src/common/menucmn.cpp diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 33ccd66f39..ae70495bef 100644 --- a/src/common/menucmn.cpp +++ b/src/common/menucmn.cpp @@ -51,7 +51,8 @@ WX_DEFINE_LIST(wxMenuItemList); wxMenuItemBase::~wxMenuItemBase() { - delete m_subMenu; + if (m_subMenu) + delete m_subMenu; } #if wxUSE_ACCEL @@ -128,7 +129,8 @@ void wxMenuBase::Init(long style) wxMenuBase::~wxMenuBase() { - // nothing to do, wxMenuItemList dtor will delete the menu items + // nothing to do, wxMenuItemList dtor will delete the menu items. + // Actually, in GTK, the submenus have to get deleted first. } // ---------------------------------------------------------------------------- @@ -301,9 +303,12 @@ wxMenuItem *wxMenuBase::FindChildItem(int id, size_t *ppos) const size_t pos; for ( pos = 0; node; pos++ ) { - item = node->GetData(); - if ( item->GetId() == id ) + if ( node->GetData()->GetId() == id ) + { + item = node->GetData(); + break; + } node = node->GetNext(); }