diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp index e79ce08676..c488a5096f 100644 --- a/cvpcb/display_footprints_frame.cpp +++ b/cvpcb/display_footprints_frame.cpp @@ -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; diff --git a/pcbnew/board.h b/pcbnew/board.h index 76c6ff89e9..2bbfe17b8b 100644 --- a/pcbnew/board.h +++ b/pcbnew/board.h @@ -1062,14 +1062,14 @@ public: }; // ------------ Run-time caches ------------- - std::mutex m_CachesMutex; - std::map< std::pair, bool > m_InsideCourtyardCache; - std::map< std::pair, bool > m_InsideFCourtyardCache; - std::map< std::pair, bool > m_InsideBCourtyardCache; - std::map< std::pair, bool > m_InsideAreaCache; - std::map< wxString, LSET > m_LayerExpressionCache; + std::mutex m_CachesMutex; + std::map< std::pair, bool > m_InsideCourtyardCache; + std::map< std::pair, bool > m_InsideFCourtyardCache; + std::map< std::pair, bool > m_InsideBCourtyardCache; + std::map< std::tuple, bool > m_InsideAreaCache; + std::map< wxString, LSET > m_LayerExpressionCache; - std::map< ZONE*, std::unique_ptr > m_CopperZoneRTrees; + std::map< ZONE*, std::unique_ptr > m_CopperZoneRTrees; private: // The default copy constructor & operator= are inadequate, diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index 80170a00f3..bcaac31071 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -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 cacheLock( board->m_CachesMutex ); - std::pair key( aArea, aItem ); - auto i = board->m_InsideAreaCache.find( key ); + BOARD* board = aArea->GetBoard(); + std::unique_lock cacheLock( board->m_CachesMutex ); + PCB_LAYER_ID layer = aCtx->GetLayer(); + std::tuple key( aArea, aItem, layer ); + auto i = board->m_InsideAreaCache.find( key ); if( i != board->m_InsideAreaCache.end() ) return i->second;