From 6cd4fcf30c4820a22fb51a591d0661be440d3574 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Mon, 18 Jan 2021 20:23:31 -0500 Subject: [PATCH] Don't pick a name with a longer path to override with Only triggered on some platforms because of compiler-dependent unordered_set iteration Fixes https://gitlab.com/kicad/code/kicad/-/issues/7169 --- eeschema/connection_graph.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index 3cf80783c8..fff5591f1e 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -1834,23 +1834,28 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph ) { for( CONNECTION_SUBGRAPH* subgraph : visited ) { + if( subgraph == original ) + continue; + CONNECTION_SUBGRAPH::PRIORITY priority = CONNECTION_SUBGRAPH::GetDriverPriority( subgraph->m_driver ); bool candidateStrong = ( priority >= CONNECTION_SUBGRAPH::PRIORITY::HIER_LABEL ); wxString candidateName = subgraph->m_driver_connection->Name(); + bool shorterPath = subgraph->m_sheet.size() < original->m_sheet.size(); + bool asGoodPath = subgraph->m_sheet.size() <= original->m_sheet.size(); // Pick a better driving subgraph if it: // a) has a power pin or global driver // b) is a strong driver and we're a weak driver // c) meets or exceeds our priority, is a strong driver, and has a shorter path - // d) is weak, we're week, and is alphabetically lower + // d) matches our strength and is at least as short, and is alphabetically lower if( ( priority >= CONNECTION_SUBGRAPH::PRIORITY::POWER_PIN ) || ( !originalStrong && candidateStrong ) || - ( priority >= highest && candidateStrong && - subgraph->m_sheet.size() < original->m_sheet.size() ) || - ( ( originalStrong == candidateStrong ) && candidateName < originalName ) ) + ( priority >= highest && candidateStrong && shorterPath ) || + ( ( originalStrong == candidateStrong ) && asGoodPath && + ( candidateName < originalName ) ) ) { original = subgraph; highest = priority;