wxMenuItemBase::~wxMenuItemBase()
{
- delete m_subMenu;
+ if (m_subMenu)
+ delete m_subMenu;
}
#if wxUSE_ACCEL
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.
}
// ----------------------------------------------------------------------------
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();
}