Skip to content

Commit 3803979

Browse files
committed
Fix #12190 - splitGeometry crashes on linear geometry with a split point
1 parent 90bd24a commit 3803979

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/core/qgsgeometry.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -4661,7 +4661,8 @@ GEOSGeometry* QgsGeometry::linePointDifference( GEOSGeometry* GEOSsplitPoint )
46614661
else
46624662
return 0;
46634663

4664-
QgsGeometry* geosPoint = fromGeosGeom( GEOSsplitPoint );
4664+
// GEOSsplitPoint will be deleted in the caller, so make a clone
4665+
QgsGeometry* geosPoint = fromGeosGeom( GEOSGeom_clone_r( geosinit.ctxt, GEOSsplitPoint ) );
46654666
QgsPoint splitPoint = geosPoint->asPoint();
46664667
delete geosPoint;
46674668

@@ -4746,9 +4747,7 @@ int QgsGeometry::splitLinearGeometry( GEOSGeometry *splitLine, QList<QgsGeometry
47464747

47474748
if ( lineGeoms.size() > 0 )
47484749
{
4749-
GEOSGeom_destroy_r( geosinit.ctxt, mGeos );
4750-
mGeos = lineGeoms[0];
4751-
mDirtyWkb = true;
4750+
fromGeos( lineGeoms[0] );
47524751
}
47534752

47544753
for ( int i = 1; i < lineGeoms.size(); ++i )

0 commit comments

Comments
 (0)