Skip to content

Commit 6354dd3

Browse files
committed
Use GEOS reentrant API (_r functions) and update requirement to GEOS >= 3.1.0
Currently QGIS uses the 'classic' GEOS API that uses a global context. This can conflict with libraries that would also use the global context and potentially finalize it whereas QGIS will still use it later. See https://groups.google.com/forum/#!topic/spatialite-users/9YSU6c5AVQ4 for such an example of such a recent issue with Spatialite. The _r API is available since GEOS 3.1.0, which is already an ancient GEOS version. For example, old-old-stable Ubuntu (Lucid 10.04) and Debian (squeeze) ship with GEOS 3.1.0 or later. Such move has also been done in GDAL 1.11 (http://lists.osgeo.org/pipermail/gdal-dev/2013-August/036877.html) and MapServer 7.0 (MapServer/MapServer#4733) There's no easy way unfortunately to check at compile time that you don't use the non _r API. I have patched my geos_c.h header to #ifdef that API (quite painfull to do..). A postprocessing check can be done however with : objdump -T output/lib/*.so | grep -v Base | grep GEOS | grep -v _r | grep -v "_ZN" | grep -v GEOSversion It should return nothing.
1 parent 45ebe53 commit 6354dd3

14 files changed

+464
-501
lines changed

cmake/FindGEOS.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ ELSE(WIN32)
8484
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GEOS_VERSION_MAJOR "${GEOS_VERSION}")
8585
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GEOS_VERSION_MINOR "${GEOS_VERSION}")
8686

87-
IF (GEOS_VERSION_MAJOR LESS 3)
88-
MESSAGE (FATAL_ERROR "GEOS version is too old (${GEOS_VERSION}). Use 3.0.0 or higher.")
89-
ENDIF (GEOS_VERSION_MAJOR LESS 3)
87+
IF (GEOS_VERSION_MAJOR LESS 3 OR (GEOS_VERSION_MAJOR EQUAL 3 AND GEOS_VERSION_MINOR LESS 1) )
88+
MESSAGE (FATAL_ERROR "GEOS version is too old (${GEOS_VERSION}). Use 3.1.0 or higher.")
89+
ENDIF (GEOS_VERSION_MAJOR LESS 3 OR (GEOS_VERSION_MAJOR EQUAL 3 AND GEOS_VERSION_MINOR LESS 1) )
9090

9191
# set INCLUDE_DIR to prefix+include
9292
EXEC_PROGRAM(${GEOS_CONFIG}

src/analysis/vector/qgsgeometryanalyzer.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,36 +1100,37 @@ bool QgsGeometryAnalyzer::createOffsetGeometry( QgsGeometry* geom, QgsGeometry*
11001100

11011101
QList<GEOSGeometry*> outputGeomList;
11021102
QList<QgsGeometry*>::const_iterator inputGeomIt = inputGeomList.constBegin();
1103+
GEOSContextHandle_t geosctxt = QgsGeometry::getGEOSHandler();
11031104
for ( ; inputGeomIt != inputGeomList.constEnd(); ++inputGeomIt )
11041105
{
11051106
if ( geom->type() == QGis::Line )
11061107
{
11071108
//geos 3.3 needed for line offsets
11081109
#if defined(GEOS_VERSION_MAJOR) && defined(GEOS_VERSION_MINOR) && \
11091110
((GEOS_VERSION_MAJOR>3) || ((GEOS_VERSION_MAJOR==3) && (GEOS_VERSION_MINOR>=3)))
1110-
GEOSGeometry* offsetGeom = GEOSOffsetCurve(( *inputGeomIt )->asGeos(), -offset, 8 /*quadSegments*/, 0 /*joinStyle*/, 5.0 /*mitreLimit*/ );
1111-
if ( !offsetGeom || !GEOSisValid( offsetGeom ) )
1111+
GEOSGeometry* offsetGeom = GEOSOffsetCurve_r(geosctxt, ( *inputGeomIt )->asGeos(), -offset, 8 /*quadSegments*/, 0 /*joinStyle*/, 5.0 /*mitreLimit*/ );
1112+
if ( !offsetGeom || !GEOSisValid_r(geosctxt, offsetGeom ) )
11121113
{
11131114
return false;
11141115
}
1115-
if ( !GEOSisValid( offsetGeom ) || GEOSGeomTypeId( offsetGeom ) != GEOS_LINESTRING || GEOSGeomGetNumPoints( offsetGeom ) < 1 )
1116+
if ( !GEOSisValid_r(geosctxt, offsetGeom ) || GEOSGeomTypeId_r(geosctxt, offsetGeom ) != GEOS_LINESTRING || GEOSGeomGetNumPoints_r(geosctxt, offsetGeom ) < 1 )
11161117
{
1117-
GEOSGeom_destroy( offsetGeom );
1118+
GEOSGeom_destroy_r(geosctxt, offsetGeom );
11181119
return false;
11191120
}
11201121
outputGeomList.push_back( offsetGeom );
11211122
#else
1122-
outputGeomList.push_back( GEOSGeom_clone(( *inputGeomIt )->asGeos() ) );
1123+
outputGeomList.push_back( GEOSGeom_clone_r(geosctxt, ( *inputGeomIt )->asGeos() ) );
11231124
#endif
11241125
}
11251126
else if ( geom->type() == QGis::Point )
11261127
{
11271128
QgsPoint p = ( *inputGeomIt )->asPoint();
11281129
p = createPointOffset( p.x(), p.y(), offset, lineGeom );
1129-
GEOSCoordSequence* ptSeq = GEOSCoordSeq_create( 1, 2 );
1130-
GEOSCoordSeq_setX( ptSeq, 0, p.x() );
1131-
GEOSCoordSeq_setY( ptSeq, 0, p.y() );
1132-
GEOSGeometry* geosPt = GEOSGeom_createPoint( ptSeq );
1130+
GEOSCoordSequence* ptSeq = GEOSCoordSeq_create_r(geosctxt, 1, 2 );
1131+
GEOSCoordSeq_setX_r(geosctxt, ptSeq, 0, p.x() );
1132+
GEOSCoordSeq_setY_r(geosctxt, ptSeq, 0, p.y() );
1133+
GEOSGeometry* geosPt = GEOSGeom_createPoint_r(geosctxt, ptSeq );
11331134
outputGeomList.push_back( geosPt );
11341135
}
11351136
}
@@ -1152,11 +1153,11 @@ bool QgsGeometryAnalyzer::createOffsetGeometry( QgsGeometry* geom, QgsGeometry*
11521153
GEOSGeometry* collection = 0;
11531154
if ( geom->type() == QGis::Point )
11541155
{
1155-
collection = GEOSGeom_createCollection( GEOS_MULTIPOINT, geomArray, outputGeomList.size() );
1156+
collection = GEOSGeom_createCollection_r(geosctxt, GEOS_MULTIPOINT, geomArray, outputGeomList.size() );
11561157
}
11571158
else if ( geom->type() == QGis::Line )
11581159
{
1159-
collection = GEOSGeom_createCollection( GEOS_MULTILINESTRING, geomArray, outputGeomList.size() );
1160+
collection = GEOSGeom_createCollection_r(geosctxt, GEOS_MULTILINESTRING, geomArray, outputGeomList.size() );
11601161
}
11611162
geom->fromGeos( collection );
11621163
delete[] geomArray;

src/analysis/vector/qgszonalstatistics.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ void QgsZonalStatistics::statisticsFromMiddlePointTest( void* band, QgsGeometry*
281281
return;
282282
}
283283

284-
const GEOSPreparedGeometry* polyGeosPrepared = GEOSPrepare( poly->asGeos() );
284+
GEOSContextHandle_t geosctxt = QgsGeometry::getGEOSHandler();
285+
const GEOSPreparedGeometry* polyGeosPrepared = GEOSPrepare_r( geosctxt, poly->asGeos() );
285286
if ( !polyGeosPrepared )
286287
{
287288
return;
@@ -300,15 +301,15 @@ void QgsZonalStatistics::statisticsFromMiddlePointTest( void* band, QgsGeometry*
300301
cellCenterX = rasterBBox.xMinimum() + pixelOffsetX * cellSizeX + cellSizeX / 2;
301302
for ( int j = 0; j < nCellsX; ++j )
302303
{
303-
GEOSGeom_destroy( currentCellCenter );
304-
cellCenterCoords = GEOSCoordSeq_create( 1, 2 );
305-
GEOSCoordSeq_setX( cellCenterCoords, 0, cellCenterX );
306-
GEOSCoordSeq_setY( cellCenterCoords, 0, cellCenterY );
307-
currentCellCenter = GEOSGeom_createPoint( cellCenterCoords );
304+
GEOSGeom_destroy_r( geosctxt, currentCellCenter );
305+
cellCenterCoords = GEOSCoordSeq_create_r( geosctxt, 1, 2 );
306+
GEOSCoordSeq_setX_r( geosctxt, cellCenterCoords, 0, cellCenterX );
307+
GEOSCoordSeq_setY_r( geosctxt, cellCenterCoords, 0, cellCenterY );
308+
currentCellCenter = GEOSGeom_createPoint_r( geosctxt, cellCenterCoords );
308309

309310
if ( scanLine[j] != mInputNodataValue ) //don't consider nodata values
310311
{
311-
if ( GEOSPreparedContains( polyGeosPrepared, currentCellCenter ) )
312+
if ( GEOSPreparedContains_r( geosctxt, polyGeosPrepared, currentCellCenter ) )
312313
{
313314
if ( !qIsNaN( scanLine[j] ) )
314315
{
@@ -322,7 +323,7 @@ void QgsZonalStatistics::statisticsFromMiddlePointTest( void* band, QgsGeometry*
322323
cellCenterY -= cellSizeY;
323324
}
324325
CPLFree( scanLine );
325-
GEOSPreparedGeom_destroy( polyGeosPrepared );
326+
GEOSPreparedGeom_destroy_r( geosctxt, polyGeosPrepared );
326327
}
327328

328329
void QgsZonalStatistics::statisticsFromPreciseIntersection( void* band, QgsGeometry* poly, int pixelOffsetX,

src/app/qgsmaptooloffsetcurve.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ void QgsMapToolOffsetCurve::setOffsetForRubberBand( double offset, bool leftSide
367367
int quadSegments = s.value( "/qgis/digitizing/offset_quad_seg", 8 ).toInt();
368368
double mitreLimit = s.value( "/qgis/digitizing/offset_miter_limit", 5.0 ).toDouble();
369369

370-
GEOSGeometry* offsetGeom = GEOSOffsetCurve( geosGeom, leftSide ? offset : -offset, quadSegments, joinStyle, mitreLimit );
370+
GEOSGeometry* offsetGeom = GEOSOffsetCurve_r( QgsGeometry::getGEOSHandler(), geosGeom, leftSide ? offset : -offset, quadSegments, joinStyle, mitreLimit );
371371
if ( !offsetGeom )
372372
{
373373
deleteRubberBandAndGeometry();

src/core/pal/feature.cpp

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#endif
4040

4141
#include <qglobal.h>
42+
#include <qgsgeometry.h>
4243

4344
#include <cmath>
4445
#include <cstring>
@@ -109,7 +110,7 @@ namespace pal
109110

110111
if ( ownsGeom )
111112
{
112-
GEOSGeom_destroy( the_geom );
113+
GEOSGeom_destroy_r( QgsGeometry::getGEOSHandler(), the_geom );
113114
the_geom = NULL;
114115
}
115116
}
@@ -123,36 +124,37 @@ namespace pal
123124
int i, j;
124125

125126
const GEOSCoordSequence *coordSeq;
127+
GEOSContextHandle_t geosctxt = QgsGeometry::getGEOSHandler();
126128

127-
type = GEOSGeomTypeId( geom );
129+
type = GEOSGeomTypeId_r( geosctxt, geom );
128130

129131
if ( type == GEOS_POLYGON )
130132
{
131-
if ( GEOSGetNumInteriorRings( geom ) > 0 )
133+
if ( GEOSGetNumInteriorRings_r( geosctxt, geom ) > 0 )
132134
{
133135
// set nbHoles, holes member variables
134-
nbHoles = GEOSGetNumInteriorRings( geom );
136+
nbHoles = GEOSGetNumInteriorRings_r( geosctxt, geom );
135137
holes = new PointSet*[nbHoles];
136138

137139
for ( i = 0; i < nbHoles; i++ )
138140
{
139141
holes[i] = new PointSet();
140142
holes[i]->holeOf = NULL;
141143

142-
const GEOSGeometry* interior = GEOSGetInteriorRingN( geom, i );
143-
holes[i]->nbPoints = GEOSGetNumCoordinates( interior );
144+
const GEOSGeometry* interior = GEOSGetInteriorRingN_r( geosctxt, geom, i );
145+
holes[i]->nbPoints = GEOSGetNumCoordinates_r( geosctxt, interior );
144146
holes[i]->x = new double[holes[i]->nbPoints];
145147
holes[i]->y = new double[holes[i]->nbPoints];
146148

147149
holes[i]->xmin = holes[i]->ymin = DBL_MAX;
148150
holes[i]->xmax = holes[i]->ymax = -DBL_MAX;
149151

150-
coordSeq = GEOSGeom_getCoordSeq( interior );
152+
coordSeq = GEOSGeom_getCoordSeq_r( geosctxt, interior );
151153

152154
for ( j = 0; j < holes[i]->nbPoints; j++ )
153155
{
154-
GEOSCoordSeq_getX( coordSeq, j, &holes[i]->x[j] );
155-
GEOSCoordSeq_getY( coordSeq, j, &holes[i]->y[j] );
156+
GEOSCoordSeq_getX_r( geosctxt, coordSeq, j, &holes[i]->x[j] );
157+
GEOSCoordSeq_getY_r( geosctxt, coordSeq, j, &holes[i]->y[j] );
156158

157159
holes[i]->xmax = holes[i]->x[j] > holes[i]->xmax ? holes[i]->x[j] : holes[i]->xmax;
158160
holes[i]->xmin = holes[i]->x[j] < holes[i]->xmin ? holes[i]->x[j] : holes[i]->xmin;
@@ -166,7 +168,7 @@ namespace pal
166168
}
167169

168170
// use exterior ring for the extraction of coordinates that follows
169-
geom = GEOSGetExteriorRing( geom );
171+
geom = GEOSGetExteriorRing_r( geosctxt, geom );
170172
}
171173
else
172174
{
@@ -175,8 +177,8 @@ namespace pal
175177
}
176178

177179
// find out number of points
178-
nbPoints = GEOSGetNumCoordinates( geom );
179-
coordSeq = GEOSGeom_getCoordSeq( geom );
180+
nbPoints = GEOSGetNumCoordinates_r( geosctxt, geom );
181+
coordSeq = GEOSGeom_getCoordSeq_r( geosctxt, geom );
180182

181183
// initialize bounding box
182184
xmin = ymin = DBL_MAX;
@@ -188,8 +190,8 @@ namespace pal
188190

189191
for ( i = 0; i < nbPoints; i++ )
190192
{
191-
GEOSCoordSeq_getX( coordSeq, i, &x[i] );
192-
GEOSCoordSeq_getY( coordSeq, i, &y[i] );
193+
GEOSCoordSeq_getX_r( geosctxt, coordSeq, i, &x[i] );
194+
GEOSCoordSeq_getY_r( geosctxt, coordSeq, i, &y[i] );
193195

194196
xmax = x[i] > xmax ? x[i] : xmax;
195197
xmin = x[i] < xmin ? x[i] : xmin;
@@ -1393,13 +1395,14 @@ namespace pal
13931395

13941396
void FeaturePart::addSizePenalty( int nbp, LabelPosition** lPos, double bbx[4], double bby[4] )
13951397
{
1396-
int geomType = GEOSGeomTypeId( the_geom );
1398+
GEOSContextHandle_t ctxt = QgsGeometry::getGEOSHandler();
1399+
int geomType = GEOSGeomTypeId_r( ctxt, the_geom );
13971400

13981401
double sizeCost = 0;
13991402
if ( geomType == GEOS_LINESTRING )
14001403
{
14011404
double length;
1402-
if ( GEOSLength( the_geom, &length ) != 1 )
1405+
if ( GEOSLength_r( ctxt, the_geom, &length ) != 1 )
14031406
return; // failed to calculate length
14041407
double bbox_length = max( bbx[2] - bbx[0], bby[2] - bby[0] );
14051408
if ( length >= bbox_length / 4 )
@@ -1410,7 +1413,7 @@ namespace pal
14101413
else if ( geomType == GEOS_POLYGON )
14111414
{
14121415
double area;
1413-
if ( GEOSArea( the_geom, &area ) != 1 )
1416+
if ( GEOSArea_r( ctxt, the_geom, &area ) != 1 )
14141417
return;
14151418
double bbox_area = ( bbx[2] - bbx[0] ) * ( bby[2] - bby[0] );
14161419
if ( area >= bbox_area / 16 )
@@ -1432,27 +1435,28 @@ namespace pal
14321435

14331436
bool FeaturePart::isConnected( FeaturePart* p2 )
14341437
{
1435-
return ( GEOSTouches( the_geom, p2->the_geom ) == 1 );
1438+
return ( GEOSTouches_r( QgsGeometry::getGEOSHandler(), the_geom, p2->the_geom ) == 1 );
14361439
}
14371440

14381441
bool FeaturePart::mergeWithFeaturePart( FeaturePart* other )
14391442
{
1440-
GEOSGeometry* g1 = GEOSGeom_clone( the_geom );
1441-
GEOSGeometry* g2 = GEOSGeom_clone( other->the_geom );
1443+
GEOSContextHandle_t ctxt = QgsGeometry::getGEOSHandler();
1444+
GEOSGeometry* g1 = GEOSGeom_clone_r( ctxt, the_geom );
1445+
GEOSGeometry* g2 = GEOSGeom_clone_r( ctxt, other->the_geom );
14421446
GEOSGeometry* geoms[2] = { g1, g2 };
1443-
GEOSGeometry* g = GEOSGeom_createCollection( GEOS_MULTILINESTRING, geoms, 2 );
1444-
GEOSGeometry* gTmp = GEOSLineMerge( g );
1445-
GEOSGeom_destroy( g );
1447+
GEOSGeometry* g = GEOSGeom_createCollection_r( ctxt, GEOS_MULTILINESTRING, geoms, 2 );
1448+
GEOSGeometry* gTmp = GEOSLineMerge_r( ctxt, g );
1449+
GEOSGeom_destroy_r( ctxt, g );
14461450

1447-
if ( GEOSGeomTypeId( gTmp ) != GEOS_LINESTRING )
1451+
if ( GEOSGeomTypeId_r( ctxt, gTmp ) != GEOS_LINESTRING )
14481452
{
14491453
// sometimes it's not possible to merge lines (e.g. they don't touch at endpoints)
1450-
GEOSGeom_destroy( gTmp );
1454+
GEOSGeom_destroy_r( ctxt, gTmp );
14511455
return false;
14521456
}
14531457

14541458
if ( ownsGeom ) // delete old geometry if we own it
1455-
GEOSGeom_destroy( the_geom );
1459+
GEOSGeom_destroy_r( ctxt, the_geom );
14561460
// set up new geometry
14571461
the_geom = gTmp;
14581462
ownsGeom = true;

src/core/pal/layer.cpp

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <cmath>
4242
#include <vector>
4343

44+
#include <qgsgeometry.h>
4445

4546
#include <pal/pal.h>
4647
#include <pal/layer.h>
@@ -285,27 +286,28 @@ namespace pal
285286
throw InternalException::UnknownGeometry();
286287
}
287288

289+
GEOSContextHandle_t geosctxt = QgsGeometry::getGEOSHandler();
288290
// if multiple labels are requested for lines, split the line in pieces of desired distance
289291
if ( repeatDistance > 0 )
290292
{
291293
int nSimpleGeometries = simpleGeometries->size();
292294
for ( int i = 0; i < nSimpleGeometries; ++i )
293295
{
294296
const GEOSGeometry* geom = simpleGeometries->pop_front();
295-
if ( GEOSGeomTypeId( geom ) == GEOS_LINESTRING )
297+
if ( GEOSGeomTypeId_r( geosctxt, geom ) == GEOS_LINESTRING )
296298
{
297-
const GEOSCoordSequence *cs = GEOSGeom_getCoordSeq( geom );
299+
const GEOSCoordSequence *cs = GEOSGeom_getCoordSeq_r( geosctxt, geom );
298300

299301
// get number of points
300302
unsigned int n;
301-
GEOSCoordSeq_getSize( cs, &n );
303+
GEOSCoordSeq_getSize_r( geosctxt, cs, &n );
302304

303305
// Read points
304306
std::vector<Point> points( n );
305307
for ( unsigned int i = 0; i < n; ++i )
306308
{
307-
GEOSCoordSeq_getX( cs, i, &points[i].x );
308-
GEOSCoordSeq_getY( cs, i, &points[i].y );
309+
GEOSCoordSeq_getX_r( geosctxt, cs, i, &points[i].x );
310+
GEOSCoordSeq_getY_r( geosctxt, cs, i, &points[i].y );
309311
}
310312

311313
// Cumulative length vector
@@ -337,26 +339,26 @@ namespace pal
337339
p.x = points[cur - 1].x + c * ( points[cur].x - points[cur - 1].x );
338340
p.y = points[cur - 1].y + c * ( points[cur].y - points[cur - 1].y );
339341
part.push_back( p );
340-
GEOSCoordSequence* cooSeq = GEOSCoordSeq_create( part.size(), 2 );
342+
GEOSCoordSequence* cooSeq = GEOSCoordSeq_create_r( geosctxt, part.size(), 2 );
341343
for ( std::size_t i = 0; i < part.size(); ++i )
342344
{
343-
GEOSCoordSeq_setX( cooSeq, i, part[i].x );
344-
GEOSCoordSeq_setY( cooSeq, i, part[i].y );
345+
GEOSCoordSeq_setX_r( geosctxt, cooSeq, i, part[i].x );
346+
GEOSCoordSeq_setY_r( geosctxt, cooSeq, i, part[i].y );
345347
}
346348

347-
simpleGeometries->push_back( GEOSGeom_createLineString( cooSeq ) );
349+
simpleGeometries->push_back( GEOSGeom_createLineString_r( geosctxt, cooSeq ) );
348350
part.clear();
349351
part.push_back( p );
350352
}
351353
// Create final part
352354
part.push_back( points[n - 1] );
353-
GEOSCoordSequence* cooSeq = GEOSCoordSeq_create( part.size(), 2 );
355+
GEOSCoordSequence* cooSeq = GEOSCoordSeq_create_r( geosctxt, part.size(), 2 );
354356
for ( std::size_t i = 0; i < part.size(); ++i )
355357
{
356-
GEOSCoordSeq_setX( cooSeq, i, part[i].x );
357-
GEOSCoordSeq_setY( cooSeq, i, part[i].y );
358+
GEOSCoordSeq_setX_r( geosctxt, cooSeq, i, part[i].x );
359+
GEOSCoordSeq_setY_r( geosctxt, cooSeq, i, part[i].y );
358360
}
359-
simpleGeometries->push_back( GEOSGeom_createLineString( cooSeq ) );
361+
simpleGeometries->push_back( GEOSGeom_createLineString_r( geosctxt, cooSeq ) );
360362
}
361363
else
362364
{
@@ -370,13 +372,13 @@ namespace pal
370372
const GEOSGeometry* geom = simpleGeometries->pop_front();
371373

372374
// ignore invalid geometries (e.g. polygons with self-intersecting rings)
373-
if ( GEOSisValid( geom ) != 1 ) // 0=invalid, 1=valid, 2=exception
375+
if ( GEOSisValid_r( geosctxt, geom ) != 1 ) // 0=invalid, 1=valid, 2=exception
374376
{
375377
std::cerr << "ignoring invalid feature " << geom_id << std::endl;
376378
continue;
377379
}
378380

379-
int type = GEOSGeomTypeId( geom );
381+
int type = GEOSGeomTypeId_r( geosctxt, geom );
380382

381383
if ( type != GEOS_POINT && type != GEOS_LINESTRING && type != GEOS_POLYGON )
382384
{
@@ -404,9 +406,9 @@ namespace pal
404406
if ( mode == LabelPerFeature && repeatDistance == 0.0 && ( type == GEOS_POLYGON || type == GEOS_LINESTRING ) )
405407
{
406408
if ( type == GEOS_LINESTRING )
407-
GEOSLength( geom, &geom_size );
409+
GEOSLength_r( geosctxt, geom, &geom_size );
408410
else if ( type == GEOS_POLYGON )
409-
GEOSArea( geom, &geom_size );
411+
GEOSArea_r( geosctxt, geom, &geom_size );
410412

411413
if ( geom_size > biggest_size )
412414
{

0 commit comments

Comments
 (0)