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
This commit is contained in:
Seth Hillbrand 2019-09-22 20:44:43 -07:00
parent 7f54617dab
commit 72da23725a
1 changed files with 1 additions and 1 deletions

View File

@ -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();