diff --git a/pcbnew/tools/conditional_menu.cpp b/pcbnew/tools/conditional_menu.cpp index f0bf514a66..dad888c163 100644 --- a/pcbnew/tools/conditional_menu.cpp +++ b/pcbnew/tools/conditional_menu.cpp @@ -48,8 +48,10 @@ void CONDITIONAL_MENU::AddSeparator( const SELECTION_CONDITION& aCondition, int CONTEXT_MENU& CONDITIONAL_MENU::Generate( SELECTION& aSelection ) { - // Clear, but do not delete entries - they are going to be reused - m_menu.GetMenuItems().clear(); + wxMenuItemList items = m_menu.GetMenuItems(); + + for( wxMenuItemList::iterator it = items.begin(); it != items.end(); ++it ) + m_menu.Remove( (*it) ); for( std::list::iterator it = m_entries.begin(); it != m_entries.end(); ++it ) {