Skip to content

Commit 3da4c33

Browse files
committedAug 13, 2017
Avoid extra copy of point in QgsGeometry::centroid()
1 parent 7f4880b commit 3da4c33

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/core/geometry/qgsgeometry.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,16 +1585,16 @@ QgsGeometry QgsGeometry::centroid() const
15851585
}
15861586

15871587
QgsGeos geos( d->geometry );
1588-
QgsPoint centroid;
1588+
std::unique_ptr<QgsPoint> centroid( new QgsPoint() );
15891589
QString error;
1590-
bool ok = geos.centroid( centroid, &error );
1590+
bool ok = geos.centroid( *centroid.get(), &error );
15911591
if ( !ok )
15921592
{
15931593
QgsGeometry geom;
15941594
geom.d->error = error;
15951595
return geom;
15961596
}
1597-
return QgsGeometry( centroid.clone() );
1597+
return QgsGeometry( centroid.release() );
15981598
}
15991599

16001600
QgsGeometry QgsGeometry::pointOnSurface() const

0 commit comments

Comments
 (0)
Please sign in to comment.