@@ -416,21 +416,21 @@ ErrorList topolTest::checkDuplicates( double tolerance, QgsVectorLayer *layer1,
416
416
417
417
QList<FeatureLayer> fls;
418
418
fls << *it << *it;
419
- QgsGeometry* conflict = new QgsGeometry ( *g1 );
419
+ QScopedPointer< QgsGeometry> conflict ( new QgsGeometry ( *g1 ) );
420
420
421
421
if ( isExtent )
422
422
{
423
- if ( canvasExtentPoly->disjoint ( conflict ) )
423
+ if ( canvasExtentPoly->disjoint ( conflict. data () ) )
424
424
{
425
425
continue ;
426
426
}
427
- if ( canvasExtentPoly->crosses ( conflict ) )
427
+ if ( canvasExtentPoly->crosses ( conflict. data () ) )
428
428
{
429
- conflict = conflict->intersection ( canvasExtentPoly );
429
+ conflict. reset ( conflict->intersection ( canvasExtentPoly ) );
430
430
}
431
431
}
432
432
433
- TopolErrorDuplicates* err = new TopolErrorDuplicates ( bb, conflict, fls );
433
+ TopolErrorDuplicates* err = new TopolErrorDuplicates ( bb, conflict. take () , fls );
434
434
435
435
errorList << err;
436
436
}
@@ -543,21 +543,21 @@ ErrorList topolTest::checkOverlaps( double tolerance, QgsVectorLayer *layer1, Qg
543
543
{
544
544
QList<FeatureLayer> fls;
545
545
fls << *it << *it;
546
- QgsGeometry* conflictGeom = g1->intersection ( g2 );
546
+ QScopedPointer< QgsGeometry > conflictGeom ( g1->intersection ( g2 ) );
547
547
548
548
if ( isExtent )
549
549
{
550
- if ( canvasExtentPoly->disjoint ( conflictGeom ) )
550
+ if ( canvasExtentPoly->disjoint ( conflictGeom. data () ) )
551
551
{
552
552
continue ;
553
553
}
554
- if ( canvasExtentPoly->crosses ( conflictGeom ) )
554
+ if ( canvasExtentPoly->crosses ( conflictGeom. data () ) )
555
555
{
556
- conflictGeom = conflictGeom->intersection ( canvasExtentPoly );
556
+ conflictGeom. reset ( conflictGeom->intersection ( canvasExtentPoly ) );
557
557
}
558
558
}
559
559
560
- TopolErrorOverlaps* err = new TopolErrorOverlaps ( bb, conflictGeom, fls );
560
+ TopolErrorOverlaps* err = new TopolErrorOverlaps ( bb, conflictGeom. take () , fls );
561
561
562
562
errorList << err;
563
563
}
@@ -637,6 +637,7 @@ ErrorList topolTest::checkGaps( double tolerance, QgsVectorLayer *layer1, QgsVec
637
637
QgsGeometry* polyGeom = QgsGeometry::fromPolygon ( polygon );
638
638
639
639
geomList.push_back ( GEOSGeom_clone_r ( geosctxt, polyGeom->asGeos () ) );
640
+ delete polyGeom;
640
641
}
641
642
642
643
}
@@ -954,6 +955,7 @@ ErrorList topolTest::checkPointCoveredBySegment( double tolerance, QgsVectorLaye
954
955
{
955
956
if ( canvasExtentPoly->disjoint ( conflictGeom ) )
956
957
{
958
+ delete conflictGeom;
957
959
continue ;
958
960
}
959
961
}
@@ -1178,7 +1180,7 @@ ErrorList topolTest::checkOverlapWithLayer( double tolerance, QgsVectorLayer* la
1178
1180
QgsRectangle r2 = g2->boundingBox ();
1179
1181
r.combineExtentWith ( &r2 );
1180
1182
1181
- QgsGeometry* conflictGeom = g1->intersection ( g2 );
1183
+ QScopedPointer< QgsGeometry> conflictGeom ( g1->intersection ( g2 ) );
1182
1184
// could this for some reason return NULL?
1183
1185
if ( !conflictGeom )
1184
1186
{
@@ -1187,13 +1189,13 @@ ErrorList topolTest::checkOverlapWithLayer( double tolerance, QgsVectorLayer* la
1187
1189
1188
1190
if ( isExtent )
1189
1191
{
1190
- if ( canvasExtentPoly->disjoint ( conflictGeom ) )
1192
+ if ( canvasExtentPoly->disjoint ( conflictGeom. data () ) )
1191
1193
{
1192
1194
continue ;
1193
1195
}
1194
- if ( canvasExtentPoly->crosses ( conflictGeom ) )
1196
+ if ( canvasExtentPoly->crosses ( conflictGeom. data () ) )
1195
1197
{
1196
- conflictGeom = conflictGeom->intersection ( canvasExtentPoly );
1198
+ conflictGeom. reset ( conflictGeom->intersection ( canvasExtentPoly ) );
1197
1199
}
1198
1200
}
1199
1201
@@ -1204,7 +1206,7 @@ ErrorList topolTest::checkOverlapWithLayer( double tolerance, QgsVectorLayer* la
1204
1206
fl.feature = f;
1205
1207
fl.layer = layer2;
1206
1208
fls << *it << fl;
1207
- TopolErrorIntersection* err = new TopolErrorIntersection ( r, conflictGeom, fls );
1209
+ TopolErrorIntersection* err = new TopolErrorIntersection ( r, conflictGeom. take () , fls );
1208
1210
1209
1211
errorList << err;
1210
1212
}
@@ -1279,6 +1281,7 @@ ErrorList topolTest::checkPointCoveredByLineEnds( double tolerance, QgsVectorLay
1279
1281
{
1280
1282
if ( canvasExtentPoly->disjoint ( conflictGeom ) )
1281
1283
{
1284
+ delete conflictGeom;
1282
1285
continue ;
1283
1286
}
1284
1287
}
@@ -1372,25 +1375,24 @@ ErrorList topolTest::checkyLineEndsCoveredByPoints( double tolerance, QgsVectorL
1372
1375
1373
1376
if ( !touched )
1374
1377
{
1375
- QgsGeometry* conflictGeom = new QgsGeometry ( *g1 );
1378
+ QScopedPointer< QgsGeometry> conflictGeom ( new QgsGeometry ( *g1 ) );
1376
1379
1377
1380
if ( isExtent )
1378
1381
{
1379
- if ( canvasExtentPoly->disjoint ( conflictGeom ) )
1382
+ if ( canvasExtentPoly->disjoint ( conflictGeom. data () ) )
1380
1383
{
1381
1384
continue ;
1382
1385
}
1383
- if ( canvasExtentPoly->crosses ( conflictGeom ) )
1386
+ if ( canvasExtentPoly->crosses ( conflictGeom. data () ) )
1384
1387
{
1385
- conflictGeom = conflictGeom->intersection ( canvasExtentPoly );
1388
+ conflictGeom. reset ( conflictGeom->intersection ( canvasExtentPoly ) );
1386
1389
}
1387
1390
}
1388
1391
QList<FeatureLayer> fls;
1389
1392
fls << *it << *it;
1390
1393
// bb.scale(10);
1391
1394
1392
-
1393
- TopolErrorLineEndsNotCoveredByPoints* err = new TopolErrorLineEndsNotCoveredByPoints ( bb, conflictGeom, fls );
1395
+ TopolErrorLineEndsNotCoveredByPoints* err = new TopolErrorLineEndsNotCoveredByPoints ( bb, conflictGeom.take (), fls );
1394
1396
errorList << err;
1395
1397
}
1396
1398
}
@@ -1456,6 +1458,7 @@ ErrorList topolTest::checkPointInPolygon( double tolerance, QgsVectorLayer *laye
1456
1458
{
1457
1459
if ( canvasExtentPoly->disjoint ( conflictGeom ) )
1458
1460
{
1461
+ delete conflictGeom;
1459
1462
continue ;
1460
1463
}
1461
1464
}
0 commit comments