Changeset 1002

Show
Ignore:
Timestamp:
01/03/08 22:15:54
Author:
seang
Message:

Abolish geom leaks in linestring and multilinestring adapters

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Shapely/trunk/shapely/geometry/linestring.py

    r942 r1002  
    177177     
    178178    context = None 
     179    __geom = None 
     180    _owned = False 
    179181 
    180182    def __init__(self, context): 
    181183        self.context = context 
    182  
    183     # Override base class __del__ 
    184     def __del__(self): 
    185         pass 
    186184 
    187185    @property 
     
    200198    def _geom(self): 
    201199        """Keeps the GEOS geometry in synch with the context.""" 
    202         return geos_linestring_from_py(self.context)[0]        
     200        if self.__geom is not None: 
     201            lgeos.GEOSGeom_destroy(self.__geom) 
     202        self.__geom = geos_linestring_from_py(self.context)[0] 
     203        return self.__geom 
    203204 
    204205    @property 
  • Shapely/trunk/shapely/geometry/multilinestring.py

    r884 r1002  
    114114     
    115115    context = None 
     116    __geom = None 
     117    _owned = False 
    116118 
    117119    def __init__(self, context): 
    118120        self.context = context 
    119  
    120     # Override base class __del__ 
    121     def __del__(self): 
    122         pass 
    123121 
    124122    @property 
     
    137135    def _geom(self): 
    138136        """Keeps the GEOS geometry in synch with the context.""" 
    139         return geos_multilinestring_from_py(self.context)[0]        
     137        if self.__geom is not None: 
     138            lgeos.GEOSGeom_destroy(self.__geom) 
     139        self.__geom = geos_multilinestring_from_py(self.context)[0] 
     140        return self.__geom 
    140141 
    141142