Opened 14 years ago

Closed 14 years ago

#2324 closed bug (fixed)

Vector - Sum lines length crashes QGIS

Reported by: gislab Owned by: cfarmer
Priority: critical: causes crash or data corruption Milestone: Version 1.5.0
Component: Python plugins and bindings Version: Trunk
Keywords: python, ftools Cc: dr, wonder
Must Fix for Release: No Platform: All
Platform Version: Awaiting user input: no

Description

Vector\Analysis\Sum lines length crashes QGIS with these two layers. This might be due to geographic CRS, but still, shouldn't crash.

Change History (10)

comment:2 by lutra, 14 years ago

Component: VectorsPython plugins and bindings
Owner: changed from nobody to cfarmer
Platform: WindowsAll

confirmed under linux. Terminal returns just "seg fault".

comment:3 by jef, 14 years ago

Cc: wonder added

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)

comment:4 by wonder, 14 years ago

Resolution: fixed
Status: newclosed

Fixed in r12627: only the copying setGeometry() is used. Thanks Juergen for pointing out.

comment:5 by dr, 14 years ago

Resolution: fixed
Status: closedreopened

bug is not fixed

comment:6 by lutra, 14 years ago

Priority: major: does not work as expectedcritical: causes crash or data corruption

This is right on the money, I just found two layers you can download here

http://mapserver.uevora.pt/~mapserver/

that do always crash qgis when the "sum line lenghts" operation is done.

In the terminal I get only a "seg fault" message.

comment:7 by lutra, 14 years ago

Well, in the case of the layers I posted it turns that if I save them in another projection (ie epsg 3763) the operation goes well. Weird.

comment:8 by lutra, 14 years ago

Moreover there are other projection (ie epsg 20790) that I can use to save the original layers that cause qgis crash when the "sum line lenghts" operation is done.

comment:9 by jef, 14 years ago

Milestone: Version 1.4.0Version 1.5.0

comment:10 by jef, 14 years ago

Resolution: fixed
Status: reopenedclosed

fixed in r13724.

Note: See TracTickets for help on using tickets.