[geos-devel] Segfault with GEOSGeom_destroy()
    Jean-Claude Repetto 
    jean-claude.repetto at worldonline.fr
       
    Wed Dec 27 07:54:50 EST 2006
    
    
  
Hello,
This is my first attempt to use the GEOS library, so I am probably doing
something wrong.
I just want to create a polygon and then to destroy it.
	initGEOS(NULL, NULL);	// GEOS initialization
	GEOSCoordSeq s = GEOSCoordSeq_create(npoints, 2);
	for (i=0; i<npoints; i++) {
		GEOSCoordSeq_setX (s, i, X[i]);
		GEOSCoordSeq_setY (s, i, Y[i]);
	}
	GEOSGeom ring = GEOSGeom_createLinearRing(s);
	GEOSGeom polygon = GEOSGeom_createPolygon(ring, NULL, 0);
	GEOSGeom_destroy(polygon);
	GEOSGeom_destroy(ring);
	GEOSCoordSeq_destroy(s);
	finishGEOS();			// Cleanup GEOS
The polygon is destroyed, but there is a segfault when the ring is
destroyed (same problem when the sequence is destroyed).
I have tested GEOS 2.2.3 and GEOS 3.0.0_RC3.
Any help would be appreciated.
Thanks,
Jean-Claude
    
    
More information about the geos-devel
mailing list