Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[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
  • Loading branch information...
commit a9c816c41b091888a99918ee4c4038eccd577d84 1 parent e3f07d2
Justin Bronn authored November 03, 2009

Showing 1 changed file with 6 additions and 2 deletions. Show diff stats Hide diff stats

  1. 8  django/contrib/gis/gdal/geometries.py
8  django/contrib/gis/gdal/geometries.py
@@ -256,11 +256,15 @@ def _get_srs(self):
256 256
 
257 257
     def _set_srs(self, srs):
258 258
         "Sets the SpatialReference for this geometry."
  259
+        # Do not have to clone the `SpatialReference` object pointer because
  260
+        # when it is assigned to this `OGRGeometry` it's internal OGR
  261
+        # reference count is incremented, and will likewise be released
  262
+        # (decremented) when this geometry's destructor is called.
259 263
         if isinstance(srs, SpatialReference):
260  
-            srs_ptr = srs_api.clone_srs(srs.ptr)
  264
+            srs_ptr = srs.ptr
261 265
         elif isinstance(srs, (int, long, basestring)):
262 266
             sr = SpatialReference(srs)
263  
-            srs_ptr = srs_api.clone_srs(sr.ptr)
  267
+            srs_ptr = sr.ptr
264 268
         else:
265 269
             raise TypeError('Cannot assign spatial reference with object of type: %s' % type(srs))
266 270
         capi.assign_srs(self.ptr, srs_ptr)

0 notes on commit a9c816c

Please sign in to comment.
Something went wrong with that request. Please try again.