From c54c254f9670546ef1a75760dfefc54119ce8dae Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 6 Mar 2023 14:30:58 +0000 Subject: [PATCH] Don't allow footprint editor pad tools to run outside footprint editor. (They can get called if a user re-assigns hotkeys to them.) Fixes https://gitlab.com/kicad/code/kicad/issues/14166 --- pcbnew/tools/pad_tool.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pcbnew/tools/pad_tool.cpp b/pcbnew/tools/pad_tool.cpp index e4aa4710c6..dbbe2d6255 100644 --- a/pcbnew/tools/pad_tool.cpp +++ b/pcbnew/tools/pad_tool.cpp @@ -282,6 +282,9 @@ int PAD_TOOL::pushPadSettings( const TOOL_EVENT& aEvent ) int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent ) { + if( !m_isFootprintEditor ) + return 0; + if( !board()->GetFirstFootprint() || board()->GetFirstFootprint()->Pads().empty() ) return 0; @@ -491,6 +494,9 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent ) int PAD_TOOL::PlacePad( const TOOL_EVENT& aEvent ) { + if( !m_isFootprintEditor ) + return 0; + if( !board()->GetFirstFootprint() ) return 0; @@ -571,6 +577,9 @@ int PAD_TOOL::PlacePad( const TOOL_EVENT& aEvent ) int PAD_TOOL::EditPad( const TOOL_EVENT& aEvent ) { + if( !m_isFootprintEditor ) + return 0; + PCB_DISPLAY_OPTIONS opts = frame()->GetDisplayOptions(); PCB_RENDER_SETTINGS* settings = static_cast( view()->GetPainter()->GetSettings() ); WX_INFOBAR* infoBar = frame()->GetInfoBar();