From bdd5a752dc118026598c496e801b21d3eb4e5c8e Mon Sep 17 00:00:00 2001 From: JamesJCode <13408010-JamesJCode@users.noreply.gitlab.com> Date: Mon, 10 Jun 2024 20:19:07 +0100 Subject: [PATCH] Don't re-add deleted netclass assignments in incremental connectivity Ensures that if moving or deleting a netclass directive label, the netclass on the previously-assigned net doesn't have the stale netclass re-applied. Cherry-picked from 0826c10a20a21ae66e193cf302ed5deb75f5f6d5 (Along with prior connectivity cherry-pick...) Fixes https://gitlab.com/kicad/code/kicad/-/issues/18173 --- eeschema/connection_graph.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index e4ab119936..3f43dbb7e0 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -2334,6 +2334,7 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function* a std::shared_ptr& netSettings = m_schematic->Prj().GetProjectFile().m_NetSettings; std::map oldAssignments = netSettings->m_NetClassLabelAssignments; + std::set affectedNetclassNetAssignments; netSettings->m_NetClassLabelAssignments.clear(); @@ -2404,10 +2405,16 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function* a if( oldAssignments.count( netname ) ) { if( oldAssignments[netname] != netclass ) + { + affectedNetclassNetAssignments.insert( netname ); dirtySubgraphs( subgraphs ); + } } else if( !netclass.IsEmpty() ) + { + affectedNetclassNetAssignments.insert( netname ); dirtySubgraphs( subgraphs ); + } }; for( const auto& [ netname, subgraphs ] : m_net_name_to_subgraphs_map ) @@ -2417,8 +2424,11 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function* a { for( auto& [ netname, netclass ] : oldAssignments ) { - if( netSettings->m_NetClassLabelAssignments.count( netname ) ) + if( netSettings->m_NetClassLabelAssignments.count( netname ) + || affectedNetclassNetAssignments.count( netname ) ) + { continue; + } netSettings->m_NetClassLabelAssignments[ netname ] = netclass; }