Skip to content

Commit

Permalink
Fix geometry checker relying on corrupting geometries to fix them
Browse files Browse the repository at this point in the history
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 3888192
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) );
Expand All @@ -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 ) ) );
Expand Down

0 comments on commit 3888192

Please sign in to comment.