From 3fc727bb91716f794f6dfde5b79f7a9014f4e772 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 11 Nov 2022 17:52:36 +0000 Subject: [PATCH] Clear selection before deleting objects during conversion. Fixes https://gitlab.com/kicad/code/kicad/issues/12879 --- pcbnew/tools/convert_tool.cpp | 5 ++++- pcbnew/tools/pcb_actions.cpp | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pcbnew/tools/convert_tool.cpp b/pcbnew/tools/convert_tool.cpp index cb48db99be..427b78cbaf 100644 --- a/pcbnew/tools/convert_tool.cpp +++ b/pcbnew/tools/convert_tool.cpp @@ -352,7 +352,10 @@ int CONVERT_TOOL::CreatePolys( const TOOL_EVENT& aEvent ) if( convertSettings.m_DeleteOriginals ) { - for( EDA_ITEM* item : selection ) + PCB_SELECTION selectionCopy = selection; + m_selectionTool->ClearSelection(); + + for( EDA_ITEM* item : selectionCopy ) { if( item->GetFlags() & SKIP_STRUCT ) commit.Remove( item ); diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 5e9b513cd8..536017024d 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -45,17 +45,17 @@ // TOOL_ACTION PCB_ACTIONS::convertToPoly( "pcbnew.Convert.convertToPoly", AS_GLOBAL, 0, "", - _( "Create Polygon from Selection" ), _( "Creates a graphic polygon from the selection" ), + _( "Create Polygon from Selection..." ), _( "Creates a graphic polygon from the selection" ), BITMAPS::add_graphical_polygon ); TOOL_ACTION PCB_ACTIONS::convertToZone( "pcbnew.Convert.convertToZone", AS_GLOBAL, 0, "", - _( "Create Zone from Selection" ), _( "Creates a copper zone from the selection" ), + _( "Create Zone from Selection..." ), _( "Creates a copper zone from the selection" ), BITMAPS::add_zone ); TOOL_ACTION PCB_ACTIONS::convertToKeepout( "pcbnew.Convert.convertToKeepout", AS_GLOBAL, 0, "", - _( "Create Rule Area from Selection" ), _( "Creates a rule area from the selection" ), + _( "Create Rule Area from Selection..." ), _( "Creates a rule area from the selection" ), BITMAPS::add_keepout_area ); TOOL_ACTION PCB_ACTIONS::convertToLines( "pcbnew.Convert.convertToLines",