Fix lifetime of markers in DRCFalseNegativeRegressions

This commit is contained in:
Jon Evans 2024-05-07 12:20:58 -04:00
parent 67f717b56a
commit e1f6d82a34
1 changed files with 6 additions and 2 deletions

View File

@ -149,6 +149,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR
KI_TEST::LoadBoard( m_settingsManager, testName, m_board ); KI_TEST::LoadBoard( m_settingsManager, testName, m_board );
// Do not refill zones here because this is testing the DRC engine, not the zone filler // Do not refill zones here because this is testing the DRC engine, not the zone filler
std::vector<PCB_MARKER> markers;
std::vector<DRC_ITEM> violations; std::vector<DRC_ITEM> violations;
BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
@ -160,10 +161,13 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR
bds.m_DRCEngine->SetViolationHandler( bds.m_DRCEngine->SetViolationHandler(
[&]( const std::shared_ptr<DRC_ITEM>& aItem, VECTOR2I aPos, int aLayer ) [&]( const std::shared_ptr<DRC_ITEM>& aItem, VECTOR2I aPos, int aLayer )
{ {
PCB_MARKER temp( aItem, aPos ); markers.emplace_back( PCB_MARKER( aItem, aPos ) );
if( bds.m_DrcExclusions.find( temp.SerializeToString() ) == bds.m_DrcExclusions.end() ) if( bds.m_DrcExclusions.find( markers.back().SerializeToString() )
== bds.m_DrcExclusions.end() )
{
violations.push_back( *aItem ); violations.push_back( *aItem );
}
} ); } );
bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false ); bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false );