OGRFeatureDefn and OGRSpatialReference Reference Counting Semantics Now Honoured

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

OGRFeatureDefn and OGRSpatialReference Reference Counting Semantics Now Honoured

Frank Warmerdam
Folks,

In the past most OGR drivers were very callous about destroying
their own OGRFeatureDefn's and OGRSpatialReferences despite the
fact that these classes have reference counting semantics.

The net outcome of this was that it was impossible, for instance, to
keep an OGRFeature alive after the corresponding layer had been
destroyed because the OGRLayer would go and destroy the OGRFeatureDefn
it shared with the feature even though the feature still had a reference on it.

I have gone through all the drivers in CVS and tried to fix this up.  The
test suite passes and I did indepth tests of many drivers with ogrinfo
and valgrind to verify things were being cleaned up properly, but I do
think the OGR should be considered a bit unstable at this time.   So
caveat emptor or be careful or something like that.

Let me know if you run into problems.

This should fix at least one class of problems coming up in the script
bindings.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Gdal-dev mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: OGRFeatureDefn and OGRSpatialReference Reference Counting Semantics Now Honoured

Charles F. I. Savage
Thanks Frank - this will make the script bindings much more stable and
easier to work with.

I've tested the changes using the Ruby unit tests that I did to check
for this problem and they now all work!

Charlie


Frank Warmerdam wrote:

> Folks,
>
> In the past most OGR drivers were very callous about destroying
> their own OGRFeatureDefn's and OGRSpatialReferences despite the
> fact that these classes have reference counting semantics.
>
> The net outcome of this was that it was impossible, for instance, to
> keep an OGRFeature alive after the corresponding layer had been
> destroyed because the OGRLayer would go and destroy the OGRFeatureDefn
> it shared with the feature even though the feature still had a reference on it.
>
> I have gone through all the drivers in CVS and tried to fix this up.  The
> test suite passes and I did indepth tests of many drivers with ogrinfo
> and valgrind to verify things were being cleaned up properly, but I do
> think the OGR should be considered a bit unstable at this time.   So
> caveat emptor or be careful or something like that.
>
> Let me know if you run into problems.
>
> This should fix at least one class of problems coming up in the script
> bindings.
>
> Best regards,


_______________________________________________
Gdal-dev mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/gdal-dev