Skip to content
Permalink
Browse files

Fix memory leaks in QgsMapCanvasSnapper

Cherry-picked from 8b6abac
  • Loading branch information
nyalldawson committed May 29, 2015
1 parent 8d5c9ad commit df9e5961f93af4ac611c386f04470dcc8f4feb16
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/gui/qgsmapcanvassnapper.cpp
@@ -305,10 +305,12 @@ int QgsMapCanvasSnapper::snapToBackgroundLayers( const QgsPoint& point, QList<Qg
QVector<QgsPoint> vertexPoints;
vertexPoints.append( iSegIt->beforeVertex );
vertexPoints.append( iSegIt->afterVertex );
QgsGeometry* lineB = QgsGeometry::fromPolyline( vertexPoints );

QgsGeometry* lineB = QgsGeometry::fromPolyline( vertexPoints );
QgsGeometry* intersectionPoint = lineA->intersection( lineB );
if ( intersectionPoint->type() == QGis::Point )
delete lineB;

if ( intersectionPoint && intersectionPoint->type() == QGis::Point )
{
//We have to check the intersection point is inside the tolerance distance for both layers
double toleranceA = 0;
@@ -331,8 +333,13 @@ int QgsMapCanvasSnapper::snapToBackgroundLayers( const QgsPoint& point, QList<Qg
iSegIt->snappedVertex = intersectionPoint->asPoint();
myResults.append( *iSegIt );
}
delete cursorPoint;
}
delete intersectionPoint;

}

delete lineA;
}

if ( myResults.length() > 0 )

0 comments on commit df9e596

Please sign in to comment.
You can’t perform that action at this time.