[geos-devel] segfault against 3.3.0 C++

Sandro Santilli strk at keybit.net
Sat Sep 10 16:44:04 EDT 2011


On Sat, Sep 10, 2011 at 08:15:01AM -0700, Matt Perry wrote:
> On Sat, Sep 10, 2011 at 3:09 AM, Sandro Santilli <strk at keybit.net> wrote:
> > On Fri, Sep 09, 2011 at 07:46:26PM +0200, Peter Körner wrote:
> >
> >> Seems OGR's exportToGEOS() followed the recommendation* and
> >> implemented the C-wrapper instead of the C++ library.
> >
> > No wonder that statically casting to Polygon* triggered segfaults...
> > I'm surprised it didn't blow up the developer's machine :D
> >
> 
> On the contrary, this code has worked for years (the software was
> written around 2006) without any apparent troubles. It was only until
> I compiled against 3.3.0 that segfaults started showing up ... and now
> looking at the code I wonder how it ever worked in the first place!?
> One thing is clear though; prior to 3.3 this code worked flawlessly.
> Just out of curiosity, I'd like to know what changed and why this
> worked at all.
> 
> So the 'right' solution is to rewrite the vector handling portions of
> the software to use the GEOS C API. That's too big a project at the
> moment so we'll probably just downgrade to 3.2.2 until we can
> eventually drum up the resources to do it the right way.

An alternative could be statically-cast to Geometry* and then
dynamic_cast to Polygon*. Try that and let us know.

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

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html


More information about the geos-devel mailing list