Ticket #13843: 13843.patch

File 13843.patch, 1.2 KB (added by Rozza, 14 years ago)

Patch to catch exceptions on deletion of already deleted geoms

  • django/contrib/gis/geos/geometry.py

     
    109109        Destroys this Geometry; in other words, frees the memory used by the
    110110        GEOS C++ object.
    111111        """
    112         if self._ptr: capi.destroy_geom(self._ptr)
     112        try:
     113            if self._ptr: capi.destroy_geom(self._ptr)
     114        except AttributeError:
     115            # Thread is dying, rest in peace.
     116            pass
    113117
    114118    def __copy__(self):
    115119        """
  • django/contrib/gis/gdal/geometries.py

     
    132132
    133133    def __del__(self):
    134134        "Deletes this Geometry."
    135         if self._ptr: capi.destroy_geom(self._ptr)
     135        try:
     136            if self._ptr: capi.destroy_geom(self._ptr)
     137        except AttributeError:
     138            # Thread is dying, rest in peace.
     139            pass
    136140
    137141    # Pickle routines
    138142    def __getstate__(self):
Back to Top