Skip to content
Permalink
Browse files

Fix geometry checker relying on corrupting geometries to fix them

Geometry checker was editing geometries in place, which potentially
was corrupting other implicitly shared copies of these geometries.
  • Loading branch information
nyalldawson committed Oct 25, 2017
1 parent 837c1c5 commit 3888192e4319cd413f70e2b80809e60fa0cc0373
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/analysis/vector/geometry_checker/qgsgeometryselfintersectioncheck.cpp
@@ -244,6 +244,7 @@ void QgsGeometrySelfIntersectionCheck::fixError( QgsGeometryCheckError *error, i
QgsFeature newFeature;
newFeature.setAttributes( feature.attributes() );
newFeature.setGeometry( QgsGeometry( poly2 ) );
feature.setGeometry( featureGeom );
featurePool->updateFeature( feature );
featurePool->addFeature( newFeature );
changes[error->layerId()][feature.id()].append( Change( ChangeRing, ChangeChanged, QgsVertexId( vidx.part, vidx.ring ) ) );
@@ -261,6 +262,7 @@ void QgsGeometrySelfIntersectionCheck::fixError( QgsGeometryCheckError *error, i
geomCollection->removeGeometry( vidx.part );
geomCollection->addGeometry( ringGeom1 );
geomCollection->addGeometry( ringGeom2 );
feature.setGeometry( featureGeom );
featurePool->updateFeature( feature );
changes[error->layerId()][feature.id()].append( Change( ChangePart, ChangeRemoved, QgsVertexId( vidx.part ) ) );
changes[error->layerId()][feature.id()].append( Change( ChangePart, ChangeAdded, QgsVertexId( geomCollection->partCount() - 2 ) ) );

0 comments on commit 3888192

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