On 21/10/2025 18:53, Even Rouault wrote:

In GDAL 3.12, OGRFeature::GetDefnRef now returns a const pointer. This means that calling Reference() or Dereference() is no longer possible. Does this mean that this is now automatic?

No. The ref count is modified when creating / destroying the layer (when it is linked to a layer), or when creating / destroying features using it.

What would be the use case for manually incrementing/decrementing the ref count of a OGRFeatureDefn* returned by OGRFeature::GetDefnRef() ?

Encapsulating the object into a wrapper when returning the object to a language with automatic GC.

If I don't do this, I will have to keep a reference to the layer or the feature. Or clone it.

--
Momtchil Momtchev <[email protected]>

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

Reply via email to