X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1dddf8389fef10a535dbcc96f5323799a852ade8..ecef04c293db3e3ebcdb12062fdc40b9b35c8c3e:/src/common/menucmn.cpp diff --git a/src/common/menucmn.cpp b/src/common/menucmn.cpp index 6c2e5631a7..5d91787665 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 @@ -124,11 +125,16 @@ void wxMenuBase::Init(long style) m_style = style; m_clientData = (void *)NULL; m_eventHandler = this; + +#if wxUSE_MENU_CALLBACK + m_callback = (wxFunction) NULL; +#endif // wxUSE_MENU_CALLBACK } 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. } // ----------------------------------------------------------------------------