Closed olivierdalang closed 2 years ago
Was able to reproduce, it is an upstream issue. The same crash can be reproduced with the following procedure:
Here it happens on QGIS 3.16.16 too though (with a hang instead of a crash).
Still I think I can come up with a workaround, as changing the attributes does not need to run the tool.
Hmm, actually I can't reproduce it reliably. It seems the crash depends on the geometry, and by the way also on 3.16. Will push the workaround mentioned above, then if it's not solved we may need to open another issue with some sample data (which will probably be an issue upstream).
For further reference, here's a crash (both in QGIS 3.22 and 3.16):
from processing.gui import AlgorithmExecutor
import math
def make_layer_with_feature(wkt):
# Prepare a feature
f = QgsFeature()
f.setGeometry(QgsGeometry.fromWkt(wkt))
f.setAttributes(["Ada"])
# Create a layer with that feature
vl = QgsVectorLayer("CurvePolygon", "temp", "memory")
vl.dataProvider().addAttributes([QgsField("name", QVariant.String)])
vl.dataProvider().addFeature(f)
# Add to the project and select it
QgsProject.instance().addMapLayer(vl)
iface.setActiveLayer(vl)
params = {"DISTANCE": 1e-6, "ANGLE": 1e-6}
alg = QgsApplication.processingRegistry().createAlgorithmById('native:converttocurves')
# Works
points = [f"{math.cos(math.radians(a))} {math.sin(math.radians(a))}" for a in range(0,180)]
segmented_arc_wkt = f"POLYGON((({','.join(points + [points[0]])})))"
make_layer_with_feature(segmented_arc_wkt)
AlgorithmExecutor.execute_in_place(alg, params)
# Crashes
curved_arc_wkt = "CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING (0 0,1 1,2 0),(2 0,0 0)))"
make_layer_with_feature(curved_arc_wkt)
AlgorithmExecutor.execute_in_place(alg, params)
Experiencing hard crash in QGIS 3.22 when editing attributes in the table with autocurve enabled
Steps to reproduce:
Full details: