mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
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
This commit is contained in:
parent
88c09517f2
commit
db97d77544
@ -578,15 +578,12 @@ bool NET_SETTINGS::HasNetclassLabelAssignment( const wxString& netName ) const
|
|||||||
|
|
||||||
void NET_SETTINGS::SetNetclassPatternAssignment( const wxString& pattern, const wxString& netclass )
|
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 )
|
for( auto& assignment : m_netClassPatternAssignments )
|
||||||
{
|
{
|
||||||
if( assignment.first->GetPattern() == pattern )
|
if( assignment.first->GetPattern() == pattern && assignment.second == netclass )
|
||||||
{
|
|
||||||
assignment.second = netclass;
|
|
||||||
ClearAllCaches();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// No assignment, add a new one
|
// No assignment, add a new one
|
||||||
|
Loading…
x
Reference in New Issue
Block a user