Take a geometry copy instead of shared object

This commit is contained in:
lbartoletti 2019-09-13 13:08:36 +02:00 committed by Nyall Dawson
parent a7cfcac68e
commit a7c766e41e

View File

@ -397,18 +397,19 @@ int QgsMapToolCapture::fetchLayerPoint( const QgsPointLocator::Match &match, Qgs
if ( !f.geometry().vertexIdFromVertexNr( match.vertexIndex(), vId ) )
return 2;
const QgsGeometry geom( f.geometry() );
if ( QgsProject::instance()->topologicalEditing() && match.hasEdge() )
{
QgsVertexId vId2;
if ( !f.geometry().vertexIdFromVertexNr( match.vertexIndex() + 1, vId2 ) )
return 2;
QgsLineString line( f.geometry().constGet()->vertexAt( vId ), f.geometry().constGet()->vertexAt( vId2 ) );
QgsLineString line( geom.constGet()->vertexAt( vId ), geom.constGet()->vertexAt( vId2 ) );
layerPoint = QgsGeometryUtils::closestPoint( line, QgsPoint( match.point() ) );
}
else
{
layerPoint = f.geometry().constGet()->vertexAt( vId );
layerPoint = geom.constGet()->vertexAt( vId );
}
// ZM support depends on the target layer