58f553a9ca requires that cache be layer-sensitive.

Fixes https://gitlab.com/kicad/code/kicad/issues/11814
This commit is contained in:
Jeff Young 2022-06-15 00:10:01 +01:00
parent b56917210d
commit 5e80e2a421
3 changed files with 18 additions and 13 deletions

View File

@ -1075,7 +1075,7 @@ public:
std::map< std::pair<BOARD_ITEM*, BOARD_ITEM*>, bool > m_InsideCourtyardCache;
std::map< std::pair<BOARD_ITEM*, BOARD_ITEM*>, bool > m_InsideFCourtyardCache;
std::map< std::pair<BOARD_ITEM*, BOARD_ITEM*>, bool > m_InsideBCourtyardCache;
std::map< std::pair<BOARD_ITEM*, BOARD_ITEM*>, bool > m_InsideAreaCache;
std::map< std::tuple<BOARD_ITEM*, BOARD_ITEM*, PCB_LAYER_ID>, bool > m_InsideAreaCache;
std::map< wxString, LSET > m_LayerExpressionCache;
std::map< ZONE*, std::unique_ptr<DRC_RTREE> > m_CopperZoneRTrees;

View File

@ -154,11 +154,15 @@ bool DRC_TEST_PROVIDER_DISALLOW::Run()
if( m_drcEngine->IsCancelled() )
break;
std::pair<BOARD_ITEM*, BOARD_ITEM*> key( ruleArea, copperZone );
std::tuple<BOARD_ITEM*, BOARD_ITEM*, PCB_LAYER_ID> key( ruleArea,
copperZone,
UNDEFINED_LAYER );
{
std::unique_lock<std::mutex> cacheLock( board->m_CachesMutex );
board->m_InsideAreaCache[ key ] = isInside;
}
done.fetch_add( 1 );
}

View File

@ -586,7 +586,8 @@ bool isInsideArea( BOARD_ITEM* aItem, const EDA_RECT& aItemBBox, PCB_EXPR_CONTEX
BOARD* board = aArea->GetBoard();
std::unique_lock<std::mutex> cacheLock( board->m_CachesMutex );
std::pair<BOARD_ITEM*, BOARD_ITEM*> key( aArea, aItem );
PCB_LAYER_ID layer = aCtx->GetLayer();
std::tuple<BOARD_ITEM*, BOARD_ITEM*, PCB_LAYER_ID> key( aArea, aItem, layer );
auto i = board->m_InsideAreaCache.find( key );
if( i != board->m_InsideAreaCache.end() )