diff --git a/common/dialogs/panel_setup_netclasses.cpp b/common/dialogs/panel_setup_netclasses.cpp index f9b2cd1670..73f3bd55a7 100644 --- a/common/dialogs/panel_setup_netclasses.cpp +++ b/common/dialogs/panel_setup_netclasses.cpp @@ -442,14 +442,11 @@ bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow() wxString netclass = m_assignmentGrid->GetCellValue( row, 1 ); m_netSettings->m_NetClassPatternAssignments.push_back( - { - std::make_unique( pattern, CTX_NETCLASS ), - netclass - } ); - - m_netSettings->m_NetClassPatternAssignmentCache.clear(); + { std::make_unique( pattern, CTX_NETCLASS ), netclass } ); } + m_netSettings->m_NetClassPatternAssignmentCache.clear(); + return true; } diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index 3bbea06880..e4ab119936 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -2375,9 +2375,6 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function* a } } - if( netclass.IsEmpty() ) - return; - if( !driverSubgraph ) driverSubgraph = subgraphs.front(); @@ -2387,7 +2384,10 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function* a { for( const auto& member : driverSubgraph->m_driver_connection->Members() ) { - netSettings->m_NetClassLabelAssignments[ member->Name() ] = netclass; + if( netclass.IsEmpty() ) + netSettings->m_NetClassLabelAssignments.erase( member->Name() ); + else + netSettings->m_NetClassLabelAssignments[member->Name()] = netclass; auto ii = m_net_name_to_subgraphs_map.find( member->Name() ); @@ -2396,9 +2396,17 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function* a } } - netSettings->m_NetClassLabelAssignments[ netname ] = netclass; + if( netclass.IsEmpty() ) + netSettings->m_NetClassLabelAssignments.erase( netname ); + else + netSettings->m_NetClassLabelAssignments[netname] = netclass; - if( oldAssignments[ netname ] != netclass ) + if( oldAssignments.count( netname ) ) + { + if( oldAssignments[netname] != netclass ) + dirtySubgraphs( subgraphs ); + } + else if( !netclass.IsEmpty() ) dirtySubgraphs( subgraphs ); };