Skip to content

Commit

Permalink
Fix memory leaks in QgsMapCanvasSnapper
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 29, 2015
1 parent 0df0986 commit 8b6abac
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/gui/qgsmapcanvassnapper.cpp
Expand Up @@ -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;
Expand All @@ -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 )
Expand Down

2 comments on commit 8b6abac

@gioman
Copy link
Contributor

@gioman gioman commented on 8b6abac May 29, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Nyall, this commit fixes http://hub.qgis.org/issues/12578 ? cheers!

@nyalldawson
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gioman possibly - my suspicion is not, but its worth verifying

Please sign in to comment.