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 0826c10a20

(Along with prior connectivity cherry-pick...)
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18173
This commit is contained in:
JamesJCode 2024-06-10 20:19:07 +01:00
parent 8dbdc3717c
commit bdd5a752dc
1 changed files with 11 additions and 1 deletions

View File

@ -2334,6 +2334,7 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
std::shared_ptr<NET_SETTINGS>& netSettings = m_schematic->Prj().GetProjectFile().m_NetSettings;
std::map<wxString, wxString> oldAssignments = netSettings->m_NetClassLabelAssignments;
std::set<wxString> affectedNetclassNetAssignments;
netSettings->m_NetClassLabelAssignments.clear();
@ -2404,10 +2405,16 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* 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<void( SCH_ITEM* )>* 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;
}