[geos-devel] segfault against 3.3.0 C++

Matt Perry perrygeo at gmail.com
Sat Sep 10 18:39:03 EDT 2011


On Sat, Sep 10, 2011 at 1:44 PM, Sandro Santilli <strk at keybit.net> wrote:
> An alternative could be statically-cast to Geometry* and then
> dynamic_cast to Polygon*. Try that and let us know.

Beautiful. It compiles fine and no segfaults on our test cases. Still
makes me nervous that this can happen anywhere in the code since the
C++ API is a moving target - the long term solution is still a C API
port but this fix buys some time. Thanks!

+	Geometry* geos_geom = (Geometry*) poly->exportToGEOS();
+	Polygon* geos_poly = dynamic_cast<Polygon*>( geos_geom );


>
> What changed ?
>  Polygon is both Areal and Geometry now (diamond inheritance).

Ahh very nice. thanks for the explanation!

-- 
·´¯`·.¸. , . .·´¯`·.. ><((((º>`·.¸¸.·´¯`·.¸.·´¯`·...¸><((((º>
"The best way to predict the future is to invent it."  -- Alan Kay
Matthew T. Perry
http://www.perrygeo.net
http://viedevelo.wordpress.com


More information about the geos-devel mailing list