[Gdal-dev] GetGeometryRef in scripts
Frank Warmerdam
warmerdam at pobox.com
Tue Sep 20 21:06:20 EDT 2005
On 9/20/05, Kevin Ruland <kruland at ku.edu> wrote:
> The current swig bindings have some short falls but I do believe they
> are fairly useable provided the developer follow the guidelines of the
> underlying C++ library. The rules in a nutshell are:
>
> 1) you must maintain a handle to the Datasource as long as you are using
> objects from it (with some exceptions such as XXX). If the Datsource is
> destroyed, developer pays for all damages.
> 2) Geometries returned by GetGeometryRef() become stale when its parent
> dies.
> 3) FieldDefn must have their parent FeatureDefn alive.
>
> I might have these wrong - the whole situation is rather confusing to me.
Kevin,
I believe your summary is correct.
> The only thing which is certainly a problem are bindings for gc
> languages. Even if the developer maintains good habits, the gc might
> still collect the trash in the wrong order.
I'm not sure why it matters what order things are destroyed in as
long as you hold a reference to things till you are done with them.
> There are a couple of ways
> to mitigate this: We could adopt a "no-fail" destructor strategy. That
> is ensure that under no circumstances will destructors being called in
> the wrong order cause troubles. Quite frankly I don't know how this can
> be done.
Perhaps you could clarify where we have problems with gc
languages. I *feel* this isn't a problem, because language
variables that reference objects should not need to do anything
at all for objects they don't own. So, for instance, a reference
to a geometry that is owned by some other object does not need
to do any work at all in it's destructor other than check it's
"owned" flag.
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
More information about the Gdal-dev
mailing list