diff options
| author | Justin Bronn <jbronn@gmail.com> | 2009-11-03 06:18:52 +0000 |
|---|---|---|
| committer | Justin Bronn <jbronn@gmail.com> | 2009-11-03 06:18:52 +0000 |
| commit | a9c816c41b091888a99918ee4c4038eccd577d84 (patch) | |
| tree | 138d6d8b440dbd96aecb6e2c4e5cc2df1a2694e0 | |
| parent | e3f07d2b4c270afd4133890b155e6b032e91f438 (diff) | |
[1.1.X] Fixed #12101 -- `OGRGeometry` does not need to create a clone of the `SpatialReference` object upon assignment.
Backport of r11707 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@11708 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/gis/gdal/geometries.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.py index 982ed5414e..91d6a6493d 100644 --- a/django/contrib/gis/gdal/geometries.py +++ b/django/contrib/gis/gdal/geometries.py @@ -256,11 +256,15 @@ class OGRGeometry(GDALBase): def _set_srs(self, srs): "Sets the SpatialReference for this geometry." + # Do not have to clone the `SpatialReference` object pointer because + # when it is assigned to this `OGRGeometry` it's internal OGR + # reference count is incremented, and will likewise be released + # (decremented) when this geometry's destructor is called. if isinstance(srs, SpatialReference): - srs_ptr = srs_api.clone_srs(srs.ptr) + srs_ptr = srs.ptr elif isinstance(srs, (int, long, basestring)): sr = SpatialReference(srs) - srs_ptr = srs_api.clone_srs(sr.ptr) + srs_ptr = sr.ptr else: raise TypeError('Cannot assign spatial reference with object of type: %s' % type(srs)) capi.assign_srs(self.ptr, srs_ptr) |
