Hi,

OGRLayer::GetLayerDefn() doc says "The returned OGRFeatureDefn is owned by the 
OGRLayer,
and should not be modified or freed by the application."

But in alg/contour.cpp, in OGRContourWriter, the return value ofGetLayerDefn is 
used to
create a feature that apparently takes ownership of the returned 
OGRFeatureDefn. When this
feature is freed at the end ofOGRContourWriter, theOGRFeatureDefn is freed.

Am I missing something ?

For info, my implementation ofGetLayerDefn is:

OGRFeatureDefn * OGRWAsPLayer::GetLayerDefn()
{
    return &oLayerDefn;
}

withoLayerDefn a member ofOGRWAsPLayer:

classOGRWAsPLayer: public OGRLayer
{
   ...
   OGRFeatureDefn        oLayerDefn;
   ...
};

Everything works fine if I replaceGetLayerDefn by:

OGRFeatureDefn * OGRWAsPLayer::GetLayerDefn()
{
    return oLayerDefn.Clone();
}

but cloning like that is not what should be done according to the doc.

Note that the xls driver creates a new "dummy"OGRFeatureDefn  in its 
implementation
ofGetLayerDefn.

_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to