don't keep dangling m_prevRadio pointer (2nd part of patch 1836644)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50298 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2007-11-28 02:54:14 +00:00
parent 088dd4c9c9
commit 8d7490018a

View File

@ -1245,11 +1245,19 @@ wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
{
if ( !wxMenuBase::DoRemove(item) )
return (wxMenuItem *)NULL;
return NULL;
GtkWidget * const mitem = item->GetMenuItem();
if ( m_prevRadio == mitem )
{
// deleting an item starts a new radio group (has to as we shouldn't
// keep a deleted pointer anyhow)
m_prevRadio = NULL;
}
// TODO: this code doesn't delete the item factory item and this seems
// impossible as of GTK 1.2.6.
gtk_widget_destroy( item->GetMenuItem() );
gtk_widget_destroy( mitem );
return item;
}