[geos-devel] segfault against 3.3.0 C++

Matt Perry perrygeo at gmail.com
Fri Sep 9 13:21:08 EDT 2011


On Fri, Sep 9, 2011 at 2:50 AM, Sandro Santilli <strk at keybit.net> wrote:
> On Fri, Sep 9, 2011 at 2:01 AM, Matt Perry <perrygeo at gmail.com> wrote:
>
>>   406          Polygon* geos_poly = (Polygon*) poly->exportToGEOS();
>
> Try dynamic_cast, and guard against 0.
>

Good idea. I tried the following:

>>   406          Polygon* geos_poly = dynamic_cast<Polygon*>( poly->exportToGEOS() );

but get a compile error...

src/traverser/traverser.cc: In member function ‘void
Traverser::processPolygon(OGRPolygon*)’:
src/traverser/traverser.cc:407:71: error: cannot dynamic_cast
‘poly->OGRPolygon::<anonymous>.OGRSurface::<anonymous>.OGRGeometry::exportToGEOS()’
(of type ‘struct GEOSGeom_t*’) to type ‘class geos::geom::Polygon*’
(source is a pointer to incomplete type)

- matt


More information about the geos-devel mailing list