diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 138740afdd..398f2661ed 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -863,11 +863,17 @@ int SELECTION_TOOL::expandSelectedConnection( const TOOL_EVENT& aEvent ) // copy the selection, since we're going to iterate and modify auto selection = m_selection.GetItems(); + // We use the BUSY flag to mark connections + for( auto item : selection ) + item->SetState( BUSY, false ); + for( auto item : selection ) { TRACK* trackItem = dynamic_cast( item ); - if( trackItem ) + // Track items marked BUSY have already been visited + // therefore their connections have already been marked + if( trackItem && !trackItem->GetState( BUSY ) ) selectAllItemsConnectedToTrack( *trackItem ); }