From 39df5f3b15eca75d4c90936ed4f381154a7a95a0 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Fri, 24 Feb 2023 22:55:32 -0500 Subject: [PATCH] Do not invalidate board caches during DRC Footprints now modify their parent container when destroyed due to 26542796, and a temporary footprint is created during DRC in some situations. This can lead to board caches being messed with during DRC which can cause unpredictable bad effects due to multithreading. Fixes https://gitlab.com/kicad/code/kicad/-/issues/13844 (cherry picked from commit 8440d7258b447f36f13f5a5f6f87bbf1f91c2c39) --- pcbnew/drc/drc_test_provider_library_parity.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pcbnew/drc/drc_test_provider_library_parity.cpp b/pcbnew/drc/drc_test_provider_library_parity.cpp index b3342cea9a..2f8f1adaa8 100644 --- a/pcbnew/drc/drc_test_provider_library_parity.cpp +++ b/pcbnew/drc/drc_test_provider_library_parity.cpp @@ -355,7 +355,13 @@ bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint ) std::unique_ptr temp( static_cast( Clone() ) ); temp->Flip( {0,0}, false ); temp->SetParentGroup( nullptr ); - return temp->FootprintNeedsUpdate( aLibFootprint ); + + bool needsUpdate = temp->FootprintNeedsUpdate( aLibFootprint ); + + // This temporary footprint must not have a parent when it goes out of scope because it must + // not trigger then IncrementTimestamp call in ~FOOTPRINT. + temp->SetParent( nullptr ); + return needsUpdate; } TEST( GetDescription(), aLibFootprint->GetDescription() );