|
@@ -96,8 +96,10 @@ class SpatialReference(GDALBase):
|
|
|
|
|
|
def __del__(self):
|
|
|
"Destroys this spatial reference."
|
|
|
- if self._ptr and capi:
|
|
|
+ try:
|
|
|
capi.release_srs(self._ptr)
|
|
|
+ except (AttributeError, TypeError):
|
|
|
+ pass # Some part might already have been garbage collected
|
|
|
|
|
|
def __getitem__(self, target):
|
|
|
"""
|
|
@@ -341,8 +343,10 @@ class CoordTransform(GDALBase):
|
|
|
|
|
|
def __del__(self):
|
|
|
"Deletes this Coordinate Transformation object."
|
|
|
- if self._ptr and capi:
|
|
|
+ try:
|
|
|
capi.destroy_ct(self._ptr)
|
|
|
+ except (AttributeError, TypeError):
|
|
|
+ pass
|
|
|
|
|
|
def __str__(self):
|
|
|
return 'Transform from "%s" to "%s"' % (self._srs1_name, self._srs2_name)
|