From 6f8a0a4eed7c10c43adee38a49bc30c2e8de303f Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 5 Jun 2019 11:14:31 +0200 Subject: [PATCH] pcbnew: Fix launching of action plugins from an action menu The action menu handler was capturing too many menuitem events. Only context menuitem highlight events and some popup menu events need to be captured Any id < 0 (like automatically assigned menuitem id) is no longer captured. Fixes: lp:1831669 https://bugs.launchpad.net/kicad/+bug/1831669 --- common/tool/action_menu.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/tool/action_menu.cpp b/common/tool/action_menu.cpp index d266707e4f..36e94cb7cb 100644 --- a/common/tool/action_menu.cpp +++ b/common/tool/action_menu.cpp @@ -399,7 +399,11 @@ void ACTION_MENU::OnMenuEvent( wxMenuEvent& aEvent ) // Handling non-action menu entries (e.g. items in clarification list) // in some context menus, that have IDs explicitly chosen between // ID_POPUP_MENU_START and ID_POPUP_MENU_END - if( !evt && ( m_selected < wxID_LOWEST || + // Note also items in clarification list have an id >= 0 and < wxID_LOWEST + // in fact 0 to n-1 for n items in clarification list) + // id < 0 are automatically created for menuitems created with wxID_ANY + #define ID_CONTEXT_MENU_ID_MAX wxID_LOWEST /* = 100 should be enough and better */ + if( !evt && ( ( m_selected >=0 && m_selected < ID_CONTEXT_MENU_ID_MAX ) || ( m_selected >= ID_POPUP_MENU_START && m_selected <= ID_POPUP_MENU_END ) )