Fix memory leak

This commit is contained in:
Nyall Dawson 2017-04-30 09:23:01 +10:00
parent 8593f3ab9e
commit e861f33b54

View File

@ -4127,9 +4127,9 @@ void TestQgsGeometry::circle()
//test conversion
QgsPointSequence ptsPol;
QgsPolygonV2 *pol = new QgsPolygonV2();
std::unique_ptr< QgsPolygonV2 > pol( new QgsPolygonV2() );
// polygon
pol = QgsCircle( QgsPointV2( 0, 0 ), 5 ).toPolygon( 4 );
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5 ).toPolygon( 4 ) );
QCOMPARE( pol->numInteriorRings(), 0 );
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
@ -4144,7 +4144,7 @@ void TestQgsGeometry::circle()
// oriented
//45
double val = 5 * sin( M_PI / 4 );
pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 45 ).toPolygon( 4 );
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 45 ).toPolygon( 4 ) );
QCOMPARE( pol->numInteriorRings(), 0 );
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
pol->exteriorRing()->points( ptsPol );
@ -4155,7 +4155,7 @@ void TestQgsGeometry::circle()
QVERIFY( ptsPol.at( 3 ) == QgsPointV2( -val, val ) );
QVERIFY( ptsPol.at( 4 ) == QgsPointV2( val, val ) );
//135
pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 135 ).toPolygon( 4 );
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 135 ).toPolygon( 4 ) );
QCOMPARE( pol->numInteriorRings(), 0 );
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
pol->exteriorRing()->points( ptsPol );
@ -4166,7 +4166,7 @@ void TestQgsGeometry::circle()
QVERIFY( ptsPol.at( 3 ) == QgsPointV2( val, val ) );
QVERIFY( ptsPol.at( 4 ) == QgsPointV2( val, -val ) );
//225
pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 225 ).toPolygon( 4 );
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 225 ).toPolygon( 4 ) );
QCOMPARE( pol->numInteriorRings(), 0 );
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
pol->exteriorRing()->points( ptsPol );
@ -4177,7 +4177,7 @@ void TestQgsGeometry::circle()
QVERIFY( ptsPol.at( 3 ) == QgsPointV2( val, -val ) );
QVERIFY( ptsPol.at( 4 ) == QgsPointV2( -val, -val ) );
//315
pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 315 ).toPolygon( 4 );
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 315 ).toPolygon( 4 ) );
QCOMPARE( pol->numInteriorRings(), 0 );
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
pol->exteriorRing()->points( ptsPol );