Opened 12 years ago

Closed 12 years ago

#4549 closed defect (invalid)

OGRLayer::CreateFeatures() causes access violation

Reported by: rhaden Owned by: tamas
Priority: highest Milestone:
Component: CSharpBindings Version: 1.8.0
Severity: blocker Keywords:
Cc:

Description

An application I've been developing requires the capability to write "flagged" features out to a shapefile. However, when calling OGRLayer::CreateFeatures() (via the C# bindings) to do this, an access-violation exception is sometimes raised.

As far as I can tell, this is dependent on two things: 1) the number and/or types of additional fields (beyond the FID and Shape fields) added to the layer definition, and 2) whether the Geometry and Feature objects that are created for writing to the shapefile are declared within using() blocks or not.

I'm honestly not sure whether this is an issue with the C# bindings to GDAL or with the underlying C/C++ GDAL code.

Change History (3)

comment:1 by rhaden, 12 years ago

Additional information: this issue (as well as the issues reported by tickets #4550 and #4551) only seems to appear at all when dealing with feature classes that don't have spatial references.

comment:2 by Even Rouault, 12 years ago

Component: defaultCSharpBindings
Owner: changed from warmerdam to tamas

A self contained sample that reproduce the issue would be likely needed

comment:3 by rhaden, 12 years ago

Resolution: invalid
Status: newclosed

Turns out I was doing things the wrong way. I was using calls to OGRFeatureDefn::AddFieldDefn() to add the extra feature fields. Using OGRLayer::CreateField() is the right way to do it. Very sorry for the false alarm!

Note: See TracTickets for help on using tickets.