From a9dc417319b2b3cea5ea1312117b14790985c8f0 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 13 May 2018 15:22:45 +0100 Subject: [PATCH] Fix bug in pruning of selection. Fixes: lp:1770939 * https://bugs.launchpad.net/kicad/+bug/1770939 --- pcbnew/tools/selection_tool.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 1fb9e6b650..138740afdd 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -382,8 +382,7 @@ SELECTION& SELECTION_TOOL::RequestSelection( int aFlags, CLIENT_SELECTION_FILTER m_selection.ClearReferencePoint(); } - // Be careful with iterators: items can be removed from list - // that invalidate iterators. + // Be careful with iterators: items can be removed from list that invalidate iterators. for( unsigned ii = 0; ii < m_selection.GetSize(); ii++ ) { EDA_ITEM* item = m_selection[ii]; @@ -391,6 +390,9 @@ SELECTION& SELECTION_TOOL::RequestSelection( int aFlags, CLIENT_SELECTION_FILTER if( ( aFlags & SELECTION_EDITABLE ) && item->Type() == PCB_MARKER_T ) { unselect( static_cast( item ) ); + + // unselect() removed the item from list. Back up to catch the following item. + ii--; } }