From 3a7068b3462e8cc12c13f179af414ba1148da73e Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 27 Sep 2022 23:53:47 +0100 Subject: [PATCH] Iterate on a copy of the selection since we're going to delete from it. Fixes https://gitlab.com/kicad/code/kicad/issues/12484 --- pcbnew/tools/edit_tool.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index b8b81260a1..5f3674d1d6 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -1056,9 +1056,10 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent ) { // Check for items becoming invisible and drop them from the selection. - LSET visible = editFrame->GetBoard()->GetVisibleLayers(); + PCB_SELECTION selCopy = selection; + LSET visible = editFrame->GetBoard()->GetVisibleLayers(); - for( EDA_ITEM* eda_item : selection ) + for( EDA_ITEM* eda_item : selCopy ) { BOARD_ITEM* item = static_cast( eda_item );