diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index 2e4da88c94..469f5a2708 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -240,7 +240,11 @@ void CONNECTION_SUBGRAPH::getAllConnectedItems( std::setm_absorbed_by; } - aSubgraphs.insert( sg ); + // If we are unable to insert the subgraph into the set, then we have already + // visited it and don't need to add it again. + if( aSubgraphs.insert( sg ).second == false ) + return; + aSubgraphs.insert( sg->m_absorbed_subgraphs.begin(), sg->m_absorbed_subgraphs.end() ); for( SCH_ITEM* item : sg->m_items )