pcbnew: Don't modify the board lists outside of class
We should not be updating the board lists without using the class_board methods. Fixes: lp:1831370 * https://bugs.launchpad.net/kicad/+bug/1831370
This commit is contained in:
parent
17b18637f8
commit
63fb408478
|
@ -1475,25 +1475,20 @@ void DRC::doFootprintOverlappingDrc()
|
||||||
void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS_T aUnits,
|
void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS_T aUnits,
|
||||||
DRC_LIST& aDRCList )
|
DRC_LIST& aDRCList )
|
||||||
{
|
{
|
||||||
auto mods = aPCB->Modules();
|
|
||||||
|
|
||||||
std::sort( mods.begin(), mods.end(), []( const MODULE* a, const MODULE* b ) {
|
// Search for duplicate footprints on the board
|
||||||
return a->GetReference().CmpNoCase( b->GetReference() );
|
auto comp = []( const MODULE* x, const MODULE* y ) {
|
||||||
} );
|
return x->GetReference().CmpNoCase( y->GetReference() ) < 0;
|
||||||
|
};
|
||||||
|
auto mods = std::set<MODULE*, decltype( comp )>( comp );
|
||||||
|
|
||||||
// Search for duplicate footprints.
|
for( auto mod : aPCB->Modules() )
|
||||||
for( auto it = mods.begin(); it != mods.end(); it++ )
|
|
||||||
{
|
{
|
||||||
auto next_it = it + 1;
|
auto ins = mods.insert( mod );
|
||||||
|
if( !ins.second )
|
||||||
if( next_it == mods.end() )
|
|
||||||
break;
|
|
||||||
|
|
||||||
if( ( *it )->GetReference().CmpNoCase( ( *next_it )->GetReference() ) == 0 )
|
|
||||||
{
|
{
|
||||||
aDRCList.emplace_back( new DRC_ITEM( aUnits, DRCE_DUPLICATE_FOOTPRINT, *it,
|
aDRCList.emplace_back( new DRC_ITEM( aUnits, DRCE_DUPLICATE_FOOTPRINT, mod,
|
||||||
( *it )->GetPosition(), *next_it, ( *next_it )->GetPosition() ) );
|
mod->GetPosition(), *ins.first, ( *ins.first )->GetPosition() ) );
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue