From ba8c3a558247183c975679f990b5ffdfbef30f5b Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 20 Mar 2020 08:38:42 -0700 Subject: [PATCH] Reverting part of cee973dc04e96140a5bafbece0b0dd6ff9aa695a Iterators are invalidated by vector reallocation. We need to keep the count in the loop in order to have a valid position in the vector Fixes https://gitlab.com/kicad/code/kicad/issues/4073 --- eeschema/connection_graph.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index f8136a4dcd..373609125c 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -1624,8 +1624,10 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph ) visit( aSubgraph ); - for( CONNECTION_SUBGRAPH* child : search_list ) + for( unsigned i = 0; i < search_list.size(); i++ ) { + auto child = search_list[i]; + visited.insert( child ); visit( child );