From e1f6d82a34eee658e5405c08506a650d508c88a7 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 7 May 2024 12:20:58 -0400 Subject: [PATCH] Fix lifetime of markers in DRCFalseNegativeRegressions --- qa/tests/pcbnew/drc/test_drc_regressions.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qa/tests/pcbnew/drc/test_drc_regressions.cpp b/qa/tests/pcbnew/drc/test_drc_regressions.cpp index f4ee2fbae2..9f0e97b0d9 100644 --- a/qa/tests/pcbnew/drc/test_drc_regressions.cpp +++ b/qa/tests/pcbnew/drc/test_drc_regressions.cpp @@ -149,6 +149,7 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR KI_TEST::LoadBoard( m_settingsManager, testName, m_board ); // Do not refill zones here because this is testing the DRC engine, not the zone filler + std::vector markers; std::vector violations; BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings(); @@ -160,10 +161,13 @@ BOOST_FIXTURE_TEST_CASE( DRCFalseNegativeRegressions, DRC_REGRESSION_TEST_FIXTUR bds.m_DRCEngine->SetViolationHandler( [&]( const std::shared_ptr& 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 ); + } } ); bds.m_DRCEngine->RunTests( EDA_UNITS::MILLIMETRES, true, false );