qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.57k stars 3k forks source link

Crash when applying geometry generator smooth to a memory layer with a circle in it. #37663

Closed baswein closed 4 years ago

baswein commented 4 years ago

Describe the bug

QGIS 3.12 crash when applying the geometry generator expression smooth($geometry,3) to a memory layer that contains a circle. If it is a .gpkg layer with a curve polygon geometry type it will also cause a crash. If it is a layer with its geometry type set to a regular polygon a circle will not cause a crash. How to Reproduce

  1. Open up QGIS
  2. Create Memory layer with type set to polygon /curve polygon
  3. Create a Circle using the shape digitizing toolbar and a 2 point circle.
  4. Set the style to geometry generator and the expression to smooth($geometry,3)
  5. QGIS crashes

QGIS and OS versions See Crash Report

Additional context I only got it to show a crash report after first adding a line based polygon and then a circle.

Crash Report

User Feedback

Tried to do geometry generator with smooth on a circle.

Report Details

Crash ID: f72c34c0bba86fc44de98ae7e7759c948d049e9b

Stack Trace

QVector::QVector qvector.h:358
QgsLineString::QgsLineString :
qgis::make_unique qgis.h:425
smoothCurve qgsgeometry.cpp:3091
QgsGeometry::smoothPolygon qgsgeometry.cpp:3186
QgsGeometry::smooth qgsgeometry.cpp:3065
fcnSmooth qgsexpressionfunction.cpp:2463
QgsStaticExpressionFunction::func qgsexpressionfunction.h:447
QgsExpressionFunction::run qgsexpressionfunction.cpp:102
QgsExpressionNodeFunction::evalNode qgsexpressionnodeimpl.cpp:901
QgsExpressionNode::eval qgsexpressionnode.cpp:29
QgsExpression::evaluate qgsexpression.cpp:373
QgsGeometryGeneratorSymbolLayer::render qgsgeometrygeneratorsymbollayer.cpp:200
QgsSymbol::renderUsingLayer qgssymbol.cpp:716
QgsFillSymbol::renderPolygon qgssymbol.cpp:2063
QgsSymbol::renderFeature qgssymbol.cpp:943
QgsFeatureRenderer::renderFeature qgsrenderer.cpp:130
QgsVectorLayerRenderer::drawRenderer qgsvectorlayerrenderer.cpp:328
QgsVectorLayerRenderer::render qgsvectorlayerrenderer.cpp:284
QgsMapRendererParallelJob::renderLayerStatic qgsmaprendererparalleljob.cpp:353
QtConcurrent::MapKernel::iterator,QtConcurrent::FunctionWrapper1 >::runIteration qtconcurrentmapkernel.h:69
QtConcurrent::MapKernel::iterator,QgsImageOperation::ProcessBlockUsingPixelOperation >::runIterations qtconcurrentmapkernel.h:78
QtConcurrent::IterateKernel::iterator,void>::forThreadFunction qtconcurrentiteratekernel.h:256
QtConcurrent::ThreadEngineBase::run :
QThreadPoolPrivate::reset :
QThread::start :
BaseThreadInitThunk :
RtlUserThreadStart :

QGIS Info QGIS Version: 3.12.3-Bucure?ti QGIS code revision: 8234261527 Compiled against Qt: 5.11.2 Running against Qt: 5.11.2 Compiled against GDAL: 3.0.4 Running against GDAL: 3.0.4

System Info CPU Type: x86_64 Kernel Type: winnt Kernel Version: 10.0.18363

gioman commented 4 years ago

QGIS Version: 3.12.3-Bucure?ti

@baswein try again after updating to 3.140.0

If it is a .gpkg layer with a curve polygon geometry type it will also cause a crash

please provide a sample dataset.

baswein commented 4 years ago

Still a probelm in QGIS 3.14.0 Here is a geopackage with 2 layers. The curve_circle layer is a cuve polygon type and contains a circle with curve and will cause a crash. The poly_circle is a regular polygon type and contains a circle and does not crash. circle.zip

User Feedback

Using Smooth on a circle geometry in geopackage.

Report Details

Crash ID: f8b1c52e90708565f7a054849c73bdc135478a57

Stack Trace

QVector::QVector qvector.h:358
QgsLineString::QgsLineString :
qgis::make_unique qgis.h:425
smoothCurve qgsgeometry.cpp:3235
QgsGeometry::smoothPolygon qgsgeometry.cpp:3330
QgsGeometry::smooth qgsgeometry.cpp:3209
fcnSmooth qgsexpressionfunction.cpp:2652
QgsStaticExpressionFunction::func qgsexpressionfunction.h:447
QgsExpressionFunction::run qgsexpressionfunction.cpp:103
QgsExpressionNodeFunction::evalNode qgsexpressionnodeimpl.cpp:933
QgsExpressionNode::eval qgsexpressionnode.cpp:29
QgsExpression::evaluate qgsexpression.cpp:372
QgsGeometryGeneratorSymbolLayer::render qgsgeometrygeneratorsymbollayer.cpp:214
QgsSymbol::renderUsingLayer qgssymbol.cpp:736
QgsFillSymbol::renderPolygon qgssymbol.cpp:2176
QgsSymbol::renderFeature qgssymbol.cpp:1152
QgsFeatureRenderer::renderFeature qgsrenderer.cpp:130
QgsVectorLayerRenderer::drawRenderer qgsvectorlayerrenderer.cpp:340
QgsVectorLayerRenderer::render qgsvectorlayerrenderer.cpp:296
QgsMapRendererParallelJob::renderLayerStatic qgsmaprendererparalleljob.cpp:353
QtConcurrent::MapKernel >::iterator,QtConcurrent::FunctionWrapper1 const & __ptr64> >::runIteration qtconcurrentmapkernel.h:69
QtConcurrent::MapKernel::iterator,QgsImageOperation::ProcessBlockUsingLineOperation >::runIterations qtconcurrentmapkernel.h:78
QtConcurrent::IterateKernel >::iterator,void>::forThreadFunction qtconcurrentiteratekernel.h:256
QtConcurrent::ThreadEngineBase::run :
QThreadPoolPrivate::reset :
QThread::start :
BaseThreadInitThunk :
RtlUserThreadStart :

QGIS Info QGIS Version: 3.14.0-Pi QGIS code revision: 9f7028fd23 Compiled against Qt: 5.11.2 Running against Qt: 5.11.2 Compiled against GDAL: 3.0.4 Running against GDAL: 3.0.4

System Info CPU Type: x86_64 Kernel Type: winnt Kernel Version: 10.0.18363

gioman commented 4 years ago

Here is a geopackage with 2 layers

@baswein attached gpkg is empty.

baswein commented 4 years ago

It seems like when it crashed it deleted the geometry or something but when I open up the file it restores it. Maybe from the .wal file? Anyway try this one it is in EPSG 4326 because I thought maybe it was the NY state-plane CRS that might have been messing it up. But it still crashes. Everything on my side says that it is in there now. curve_circle_4326_3.zip

gioman commented 4 years ago

Crash confirmed on master on Ubuntu 18.04.

baswein commented 4 years ago

I also tried non circle curved shape and that crashed it as well.