diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index 177c21dadf..729d6c54a3 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -299,6 +299,13 @@ int PAD::GetBoundingRadius() const void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const { + std::lock_guard 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; diff --git a/pcbnew/pad.h b/pcbnew/pad.h index 9fc3ddcdb7..24a67f23a6 100644 --- a/pcbnew/pad.h +++ b/pcbnew/pad.h @@ -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 m_effectiveShape;