Netclass: allow multiple assignments with the same pattern
This isn't really a problem, and overwriting the entry allows
for silent data loss by making a new assignment with the
same pattern as an existing one.
The resolve netclasses are de-duplicated later, so it's even
OK if the whole assignment is duplicated (in theory), but
continue to clean these up.
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/21316
(cherry picked from commit db97d77544)
This commit is contained in:
@@ -558,15 +558,12 @@ bool NET_SETTINGS::HasNetclassLabelAssignment( const wxString& netName ) const
|
||||
|
||||
void NET_SETTINGS::SetNetclassPatternAssignment( const wxString& pattern, const wxString& netclass )
|
||||
{
|
||||
// Replace existing assignment if we have one
|
||||
// Avoid exact duplicates - these shouldn't cause problems, due to later de-duplication
|
||||
// but they are unnecessary.
|
||||
for( auto& assignment : m_netClassPatternAssignments )
|
||||
{
|
||||
if( assignment.first->GetPattern() == pattern )
|
||||
{
|
||||
assignment.second = netclass;
|
||||
ClearAllCaches();
|
||||
if( assignment.first->GetPattern() == pattern && assignment.second == netclass )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// No assignment, add a new one
|
||||
|
||||
Reference in New Issue
Block a user