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:
Seth Hillbrand 2019-06-02 07:26:32 -07:00
parent 17b18637f8
commit 63fb408478
1 changed files with 10 additions and 15 deletions

View File

@ -1475,25 +1475,20 @@ void DRC::doFootprintOverlappingDrc()
void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS_T aUnits,
DRC_LIST& aDRCList )
{
auto mods = aPCB->Modules();
std::sort( mods.begin(), mods.end(), []( const MODULE* a, const MODULE* b ) {
return a->GetReference().CmpNoCase( b->GetReference() );
} );
// Search for duplicate footprints on the board
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 it = mods.begin(); it != mods.end(); it++ )
for( auto mod : aPCB->Modules() )
{
auto next_it = it + 1;
if( next_it == mods.end() )
break;
if( ( *it )->GetReference().CmpNoCase( ( *next_it )->GetReference() ) == 0 )
auto ins = mods.insert( mod );
if( !ins.second )
{
aDRCList.emplace_back( new DRC_ITEM( aUnits, DRCE_DUPLICATE_FOOTPRINT, *it,
( *it )->GetPosition(), *next_it, ( *next_it )->GetPosition() ) );
break;
aDRCList.emplace_back( new DRC_ITEM( aUnits, DRCE_DUPLICATE_FOOTPRINT, mod,
mod->GetPosition(), *ins.first, ( *ins.first )->GetPosition() ) );
}
}