Do NOT return false from a visitor unless you want to stop visiting!

This fixes a bug where DRC would bail out early if any of
the colliding objects was a free pad.
This commit is contained in:
Jeff Young 2024-01-04 12:02:54 +00:00
parent 3ab23201b4
commit d33fbd8e47
1 changed files with 7 additions and 3 deletions

View File

@ -584,6 +584,9 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances()
// Visitor:
[&]( BOARD_ITEM* other ) -> bool
{
if( m_drcEngine->IsCancelled() )
return false;
if( other->Type() == PCB_PAD_T && static_cast<PAD*>( other )->IsFreePad() )
{
if( other->GetEffectiveShape( layer )->Collide( trackShape.get() ) )
@ -593,11 +596,11 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances()
if( it == freePadsUsageMap.end() )
{
freePadsUsageMap[ other ] = track->GetNetCode();
return false;
return true; // Continue colliding tests
}
else if( it->second == track->GetNetCode() )
{
return false;
return true; // Continue colliding tests
}
}
}
@ -619,7 +622,8 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testTrackClearances()
if( it != checkedPairs.end() )
it->second.has_error = true;
return m_drcEngine->GetReportAllTrackErrors() && !m_drcEngine->IsCancelled();
if( !m_drcEngine->GetReportAllTrackErrors() )
return false; // We're done with this track
}
return !m_drcEngine->IsCancelled();