[Shapelib] Delete or hide Shape from Shapefile

Jelmer Baas Baas at speerit.nl
Tue May 19 09:31:42 EST 2009


Fantastic, that fixed the crash. 

Thanks again :)

Regards
Jelmer Baas

> -----Original Message-----
> From: shapelib-bounces at lists.maptools.org 
> [mailto:shapelib-bounces at lists.maptools.org] On Behalf Of 
> Frank Warmerdam
> Sent: dinsdag 19 mei 2009 15:49
> To: Shapelib Development
> Subject: Re: [Shapelib] Delete or hide Shape from Shapefile
> 
> Jelmer Baas wrote:
> > The following code freezes my application:
> > 
> >     Dim intShapeFile As Integer, intEntities As Integer, 
> objShapeType As
> > MapTools.ShapeLib.ShapeType
> >     Dim minB(2) As Double, maxB(2) As Double
> > 
> >     intShapeFile = SHPOpen("C:\test\test.shp", "rb+")
> >     SHPGetInfo(intShapeFile, intEntities, objShapeType, minB, maxB)
> >     SHPClose(intShapeFile)
> >     System.GC.Collect()
> > 
> > I tried a different shape file, same problem. MapServer can properly
> > draw the shapes, so 
> > I think it's a valid file, too. There's no way to recover 
> except kill
> > the application.
> > 
> > 
> > Well, wouldn't you know. While typing this I had another 
> idea: to skip
> > SHPGetInfo, and that 
> > does the trick. Question remains: why does SHPGetInfo crash 
> the app when
> > using Shapelib?
> 
> Jelmer,
> 
> The minB, maxB arguments to SHPGetInfo() should be 
> dimensioned with a size
> of four (X, Y, Z, measure), not 2.  I presume SHPGetInfo is 
> writing past
> the end of your arrays and corrupting the heap.
> 
> Best regards,
> -- 
> ---------------------------------------+----------------------
> ----------------
> I set the clouds in motion - turn up   | Frank Warmerdam, 
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial 
> Programmer for Rent
> 
> _______________________________________________
> Shapelib mailing list
> Shapelib at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/shapelib
> 


More information about the Shapelib mailing list