Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -305,10 +305,12 @@ int QgsMapCanvasSnapper::snapToBackgroundLayers( const QgsPoint& point, QList<Qg
305
305
QVector<QgsPoint> vertexPoints;
306
306
vertexPoints.append ( iSegIt->beforeVertex );
307
307
vertexPoints.append ( iSegIt->afterVertex );
308
- QgsGeometry* lineB = QgsGeometry::fromPolyline ( vertexPoints );
309
308
309
+ QgsGeometry* lineB = QgsGeometry::fromPolyline ( vertexPoints );
310
310
QgsGeometry* intersectionPoint = lineA->intersection ( lineB );
311
- if ( intersectionPoint->type () == QGis::Point )
311
+ delete lineB;
312
+
313
+ if ( intersectionPoint && intersectionPoint->type () == QGis::Point )
312
314
{
313
315
// We have to check the intersection point is inside the tolerance distance for both layers
314
316
double toleranceA = 0 ;
@@ -331,8 +333,13 @@ int QgsMapCanvasSnapper::snapToBackgroundLayers( const QgsPoint& point, QList<Qg
331
333
iSegIt->snappedVertex = intersectionPoint->asPoint ();
332
334
myResults.append ( *iSegIt );
333
335
}
336
+ delete cursorPoint;
334
337
}
338
+ delete intersectionPoint;
339
+
335
340
}
341
+
342
+ delete lineA;
336
343
}
337
344
338
345
if ( myResults.length () > 0 )
0 commit comments