#9448: segfault: django.contrib.gis.gdal.DataSource sub-objects not holding
references to parents
-------------------------------------------------+--------------------------
Reporter: [EMAIL PROTECTED] | Owner: jbronn
Status: assigned | Milestone: post-1.0
Component: GIS | Version: 1.0
Resolution: | Keywords:
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------------------------+--------------------------
Comment (by anonymous):
Justin,
Well, you beat me to the patch; I was sleeping on a diff that is basically
indistinguishable from yours.
The reason that it's a problem for `Layer`s but not for `Feature`s turns
out to be something of an OGR wart: `GetLayer` returns a pointer to a
layer object that is owned by the `DataSet`, but functions like
`GetNextFeature` return copies of the individual features, which it's up
to you to destroy. You’re already doing that correctly: that's why
`Feature` needs (and has) a `__del__` method but `Layer` does not.
I spent some time last night looking through the code in more detail, and
I'm now pretty convinced that the `Layer` code is the only place that has
his issue. I agree that you need to fix it at the level of the `Layer`
and `DataSet` objects, and not lower down in the `ctypes` wrapper muck,
because resource destruction is handled by the `DataSource`'s `__del__`
method and so it's the lifetime of the `DataSource` object itself that we
need to extend.
This patch looks great to me, and fixes my problem.
--
Ticket URL: <http://code.djangoproject.com/ticket/9448#comment:4>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---