Skip to content

Commit

Permalink
Take a geometry copy instead of shared object
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and nyalldawson committed Oct 26, 2019
1 parent a7cfcac commit a7c766e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gui/qgsmaptoolcapture.cpp
Expand Up @@ -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
Expand Down

0 comments on commit a7c766e

Please sign in to comment.