From ba630971afd6ee8c44d6c9b1929ed721389c566c Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 30 Sep 2022 23:05:06 +0100 Subject: [PATCH] Possible fix for move/esc/esc crash. Fixes https://gitlab.com/kicad/code/kicad/issues/12553 --- pcbnew/tools/edit_tool_move_fct.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pcbnew/tools/edit_tool_move_fct.cpp b/pcbnew/tools/edit_tool_move_fct.cpp index e9127bf2f3..bbfad05c68 100644 --- a/pcbnew/tools/edit_tool_move_fct.cpp +++ b/pcbnew/tools/edit_tool_move_fct.cpp @@ -997,6 +997,11 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference ) // Discard reference point when selection is "dropped" onto the board selection.ClearReferencePoint(); + // Unselect all items to clear selection flags and then re-select the originally selected + // items. + m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); + m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &orig_items ); + // TODO: there's an encapsulation leak here: this commit often has more than just the move // in it; for instance it might have a paste, append board, etc. as well. if( restore_state ) @@ -1007,11 +1012,6 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, bool aPickReference ) // Remove the dynamic ratsnest from the screen m_toolMgr->RunAction( PCB_ACTIONS::hideLocalRatsnest, true ); - // Unselect all items to clear selection flags and then re-select the originally selected - // items. - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); - m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &orig_items ); - editFrame->PopTool( aEvent ); editFrame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );