[QGIS-trac] Re: [Quantum GIS] #2324: Vector - Sum lines length crashes QGIS

Quantum GIS qgis at qgis.org
Thu Dec 24 08:37:11 EST 2009


#2324: Vector  - Sum lines length crashes QGIS
-----------------------------------------------------+----------------------
        Reporter:  gislab                            |         Owner:  cfarmer      
            Type:  bug                               |        Status:  new          
        Priority:  major: does not work as expected  |     Milestone:  Version 1.4.0
       Component:  Python plugins and bindings       |       Version:  HEAD         
      Resolution:                                    |      Keywords:  python,ftools
Platform_version:                                    |      Platform:  All          
        Must_fix:  No                                |   Status_info:  0            
-----------------------------------------------------+----------------------
Changes (by jef):

 * cc: wonder (added)

Comment:

 Looks like this was caused by r12597.  In
 [[http://trac.osgeo.org/qgis/browser/trunk/qgis/python/plugins/fTools/tools/doSumLines.py#L142
 doSumLines:412]] the output feature now takes ownership of the input
 polygon, although the input geometry still owns it.  That way the geometry
 is freed twice, when {{{compute}}} ends.

 Following change cures that, but as that is probably not the only place
 with that construct, we'd probably be better of reverting the r12597.
 Ccing Martin.

 {{{
 Index: python/plugins/fTools/tools/doSumLines.py
 ===================================================================
 --- python/plugins/fTools/tools/doSumLines.py   (revision 12612)
 +++ python/plugins/fTools/tools/doSumLines.py   (working copy)
 @@ -139,7 +139,7 @@
                                         if
 inGeom.intersects(i.geometry()):
                                                 outGeom =
 inGeom.intersection(i.geometry())
                                                 length = length +
 distArea.measure(outGeom)
 -                       outFeat.setGeometry(inGeom)
 +                       outFeat.setGeometry( QgsGeometry(inGeom) )
                         outFeat.setAttributeMap(atMap)
                         outFeat.addAttribute(index, QVariant(length))
                         writer.addFeature(outFeat)
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/qgis/ticket/2324#comment:3>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list