[Qgis-developer] Use GEOS reentrant API (_r functions) and update requirement to GEOS >= 3.1.0

Even Rouault even.rouault at mines-paris.org
Tue Jun 17 13:37:42 PDT 2014


Hi,

I've submitted the following (big in terme of lines changed, but mostly 
boring) pull request https://github.com/qgis/QGIS/pull/1461 :
"""
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.

To test the conditional branches on GEOS versions for advanced GEOS features, 
compile-tested by simulating GEOS 3.1.0 and GEOS 3.4.2
"""

One thing that comes to mind is if QGIS might use GEOS concurrently from 
multiple threads. If so, then this patch will not improve (nor worsen) the 
situation with respect to potential problems that might arise from that.

Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the Qgis-developer mailing list