Commit e37b07a6 authored by Maciej Suminski's avatar Maciej Suminski

Explicit destruction of menu entries in CONTEXT_MENU.

parent b218c109
...@@ -152,7 +152,7 @@ std::list<wxMenuItem*> CONTEXT_MENU::Add( CONTEXT_MENU* aMenu, const wxString& a ...@@ -152,7 +152,7 @@ std::list<wxMenuItem*> CONTEXT_MENU::Add( CONTEXT_MENU* aMenu, const wxString& a
if( aExpand ) if( aExpand )
{ {
for( unsigned int i = 0; i < aMenu->GetMenuItemCount(); ++i ) for( int i = 0; i < (int) aMenu->GetMenuItemCount(); ++i )
{ {
wxMenuItem* item = aMenu->FindItemByPosition( i ); wxMenuItem* item = aMenu->FindItemByPosition( i );
items.push_back( appendCopy( item ) ); items.push_back( appendCopy( item ) );
...@@ -184,10 +184,10 @@ void CONTEXT_MENU::Clear() ...@@ -184,10 +184,10 @@ void CONTEXT_MENU::Clear()
{ {
m_titleSet = false; m_titleSet = false;
GetMenuItems().DeleteContents( true ); for( int i = GetMenuItemCount() - 1; i >= 0; --i )
GetMenuItems().Clear(); Destroy( FindItemByPosition( i ) );
m_toolActions.clear(); m_toolActions.clear();
GetMenuItems().DeleteContents( false ); // restore the default so destructor does not go wild
m_submenus.clear(); m_submenus.clear();
m_parent = NULL; m_parent = NULL;
...@@ -333,7 +333,7 @@ void CONTEXT_MENU::copyFrom( const CONTEXT_MENU& aMenu ) ...@@ -333,7 +333,7 @@ void CONTEXT_MENU::copyFrom( const CONTEXT_MENU& aMenu )
m_update_handler = aMenu.m_update_handler; m_update_handler = aMenu.m_update_handler;
// Copy all the menu entries // Copy all the menu entries
for( unsigned i = 0; i < aMenu.GetMenuItemCount(); ++i ) for( int i = 0; i < (int) aMenu.GetMenuItemCount(); ++i )
{ {
wxMenuItem* item = aMenu.FindItemByPosition( i ); wxMenuItem* item = aMenu.FindItemByPosition( i );
appendCopy( item ); appendCopy( item );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment