summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-09-12 20:45:59 +0200
committerClaude Paroz <claude@2xlibre.net>2014-09-12 20:45:59 +0200
commit8f334e55be99ae271d82f9b961a2dc6258487d9c (patch)
tree1f994b64c9b9d5ff08ac922ad22453f8f2caebb0
parentb011afe6c86951a71313c106dce6639c647f6c95 (diff)
Fixed #13843 -- Prevented AttributeError during geometry objects deletion
-rw-r--r--django/contrib/gis/gdal/datasource.py2
-rw-r--r--django/contrib/gis/gdal/feature.py2
-rw-r--r--django/contrib/gis/gdal/geometries.py2
-rw-r--r--django/contrib/gis/gdal/srs.py2
-rw-r--r--django/contrib/gis/geos/geometry.py2
-rw-r--r--django/contrib/gis/geos/prepared.py2
-rw-r--r--django/contrib/gis/geos/prototypes/threadsafe.py2
7 files changed, 7 insertions, 7 deletions
diff --git a/django/contrib/gis/gdal/datasource.py b/django/contrib/gis/gdal/datasource.py
index 864f50af52..6caa2a9068 100644
--- a/django/contrib/gis/gdal/datasource.py
+++ b/django/contrib/gis/gdal/datasource.py
@@ -96,7 +96,7 @@ class DataSource(GDALBase):
def __del__(self):
"Destroys this DataStructure object."
- if self._ptr:
+ if self._ptr and capi:
capi.destroy_ds(self._ptr)
def __iter__(self):
diff --git a/django/contrib/gis/gdal/feature.py b/django/contrib/gis/gdal/feature.py
index d020b34488..2184aeb708 100644
--- a/django/contrib/gis/gdal/feature.py
+++ b/django/contrib/gis/gdal/feature.py
@@ -34,7 +34,7 @@ class Feature(GDALBase):
def __del__(self):
"Releases a reference to this object."
- if self._ptr:
+ if self._ptr and capi:
capi.destroy_feature(self._ptr)
def __getitem__(self, index):
diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.py
index e3f76ef162..0006923e42 100644
--- a/django/contrib/gis/gdal/geometries.py
+++ b/django/contrib/gis/gdal/geometries.py
@@ -127,7 +127,7 @@ class OGRGeometry(GDALBase):
def __del__(self):
"Deletes this Geometry."
- if self._ptr:
+ if self._ptr and capi:
capi.destroy_geom(self._ptr)
# Pickle routines
diff --git a/django/contrib/gis/gdal/srs.py b/django/contrib/gis/gdal/srs.py
index 3c1a82083b..71052b25e9 100644
--- a/django/contrib/gis/gdal/srs.py
+++ b/django/contrib/gis/gdal/srs.py
@@ -97,7 +97,7 @@ class SpatialReference(GDALBase):
def __del__(self):
"Destroys this spatial reference."
- if self._ptr:
+ if self._ptr and capi:
capi.release_srs(self._ptr)
def __getitem__(self, target):
diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py
index 3cee800f1c..fb36306503 100644
--- a/django/contrib/gis/geos/geometry.py
+++ b/django/contrib/gis/geos/geometry.py
@@ -115,7 +115,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
Destroys this Geometry; in other words, frees the memory used by the
GEOS C++ object.
"""
- if self._ptr:
+ if self._ptr and capi:
capi.destroy_geom(self._ptr)
def __copy__(self):
diff --git a/django/contrib/gis/geos/prepared.py b/django/contrib/gis/geos/prepared.py
index 5458264f19..98ab1554ea 100644
--- a/django/contrib/gis/geos/prepared.py
+++ b/django/contrib/gis/geos/prepared.py
@@ -23,7 +23,7 @@ class PreparedGeometry(GEOSBase):
self.ptr = capi.geos_prepare(geom.ptr)
def __del__(self):
- if self._ptr:
+ if self._ptr and capi:
capi.prepared_destroy(self._ptr)
def contains(self, other):
diff --git a/django/contrib/gis/geos/prototypes/threadsafe.py b/django/contrib/gis/geos/prototypes/threadsafe.py
index 3f979b3def..61b13792bc 100644
--- a/django/contrib/gis/geos/prototypes/threadsafe.py
+++ b/django/contrib/gis/geos/prototypes/threadsafe.py
@@ -12,7 +12,7 @@ class GEOSContextHandle(object):
self.ptr = lgeos.initGEOS_r(notice_h, error_h)
def __del__(self):
- if self.ptr:
+ if self.ptr and lgeos:
lgeos.finishGEOS_r(self.ptr)