Thread safety for pad effective shape building.

This commit is contained in:
Jeff Young 2020-12-28 19:47:47 +00:00
parent cfb4e34b07
commit 3e2aa8df3a
2 changed files with 8 additions and 0 deletions

View File

@ -299,6 +299,13 @@ int PAD::GetBoundingRadius() const
void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
{
std::lock_guard<std::mutex> RAII_lock( m_shapesBuildingLock );
// If we had to wait for the lock then we were probably waiting for someone else to
// finish rebuilding the shapes. So check to see if they're clean now.
if( !m_shapesDirty )
return;
BOARD* board = GetBoard();
int maxError = board ? board->GetDesignSettings().m_MaxError : ARC_HIGH_DEF;

View File

@ -655,6 +655,7 @@ private:
// Must be set to true to force rebuild shapes to draw (after geometry change for instance)
mutable bool m_shapesDirty;
mutable std::mutex m_shapesBuildingLock;
mutable int m_effectiveBoundingRadius;
mutable EDA_RECT m_effectiveBoundingBox;
mutable std::shared_ptr<SHAPE_COMPOUND> m_effectiveShape;