58f553a9ca requires that cache be layer-sensitive.

Fixes https://gitlab.com/kicad/code/kicad/issues/11814

(cherry picked from commit 5e80e2a421)
This commit is contained in:
Jeff Young 2022-06-15 00:10:01 +01:00
parent f75104d456
commit afc491c5a5
3 changed files with 14 additions and 11 deletions

View File

@ -453,6 +453,7 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
{
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
COMPONENT* comp = parentframe->GetSelectedComponent();
FOOTPRINT* footprint = nullptr;
const FOOTPRINT_INFO* fpInfo = nullptr;
@ -480,6 +481,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
}
if( footprint )
{
GetBoard()->Add( footprint );
m_currentFootprint = footprintName;
m_currentComp = comp;

View File

@ -1062,14 +1062,14 @@ public:
};
// ------------ Run-time caches -------------
std::mutex m_CachesMutex;
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< wxString, LSET > m_LayerExpressionCache;
std::mutex m_CachesMutex;
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::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;
std::map< ZONE*, std::unique_ptr<DRC_RTREE> > m_CopperZoneRTrees;
private:
// The default copy constructor & operator= are inadequate,

View File

@ -576,10 +576,11 @@ bool isInsideArea( BOARD_ITEM* aItem, const EDA_RECT& aItemBBox, PCB_EXPR_CONTEX
if( !aArea || aArea == aItem || aArea->GetParent() == aItem )
return false;
BOARD* board = aArea->GetBoard();
std::unique_lock<std::mutex> cacheLock( board->m_CachesMutex );
std::pair<BOARD_ITEM*, BOARD_ITEM*> key( aArea, aItem );
auto i = board->m_InsideAreaCache.find( key );
BOARD* board = aArea->GetBoard();
std::unique_lock<std::mutex> cacheLock( board->m_CachesMutex );
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() )
return i->second;