Browse Source

pcbnew: Don't copy const structures when not needed

Copying the const pointer on large structures (filled zones) will be
very slow and memory intensive.  This can cause OOM on linux and extreme
slowdowns when the save is triggered.

Fixes: lp:1840168
* https://bugs.launchpad.net/kicad/+bug/1840168
pull/15/head
Seth Hillbrand 6 years ago
parent
commit
72da23725a
  1. 2
      include/geometry/shape_poly_set.h

2
include/geometry/shape_poly_set.h

@ -171,7 +171,7 @@ class SHAPE_POLY_SET : public SHAPE
if( m_currentPolygon != m_poly->OutlineCount() - 1 )
return false;
auto currentPolygon = m_poly->CPolygon( m_currentPolygon );
const auto& currentPolygon = m_poly->CPolygon( m_currentPolygon );
return m_currentContour < (int) currentPolygon.size() - 1
|| m_currentVertex < currentPolygon[m_currentContour].PointCount();

Loading…
Cancel
Save