From 6788e31a1e0bdaa2e2b01af1541799bb408bb63c Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Mon, 18 May 2015 13:48:12 +0200 Subject: [PATCH] Fixed context menu crash on OS X (GAL). --- pcbnew/tools/conditional_menu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 ) {