Bug report #19993

Updated by Jürgen Fischer about 5 years ago

This was the code that caused the crash:

<pre>
import itertools
layer = iface.activeLayer()
feats = [ feat for feat in layer.getFeatures() ]
selected_feats = []
selected_feats.append(feats[0])
del feats[0]
k=0
while len(feats) !=0:
for i, feat in enumerate(feats):
d = selected_feats[k].geometry().distance(feat.geometry())
if d == 0:
selected_feats.append(feat)
k +=1
del feats[i]
lines = [ feat.geometry().asPolyline() for feat in selected_feats ]
epsg = layer.crs().postgisSrid()
uri = "LineString?crs=epsg:" + str(epsg) + "&field=id:integer""&index=yes"
mem_layer = QgsVectorLayer(uri,
'4testing_feats_ordered',
'memory')
prov = mem_layer.dataProvider()
feats = [ QgsFeature() for i in range(len(selected_feats)) ]
for i, feat in enumerate(feats):
feat.setAttributes([i])
feat.setGeometry(QgsGeometry.fromPolyline(lines[i]))
prov.addFeatures(feats)
QgsProject.instance().addMapLayer(mem_layer)
</pre>


This was the bug report after the crash:

h2. User Feedback

h2. Report Details

*Crash ID*: e75beb8f185e848f989ceaa0bae49ce173157d10

*Stack Trace*
<pre>
SpatialIndex::MVRTree::Data::storeToByteArray :
SpatialIndex::RTree::Data::getShape :
SpatialIndex::RTree::Data::getShape :
QgsSpatialIndex::insertFeature :
QgsSpatialIndex::insertFeature :
QgsProcessingModelOutput::toVariant :
std::_String_alloc<std::_String_base_types<char,std::allocator<char> > >::_Getal :
PyCFunction_FastCallDict :
PyObject_GenericGetAttr :
PyEval_EvalFrameDefault :
PyErr_Occurred :
PyEval_EvalCode :
PyDict_SetItemId :
PyDict_SetItemId :
PyCFunction_FastCallDict :
PyObject_GenericGetAttr :
PyEval_EvalFrameDefault :
PyObject_GenericGetAttr :
PyEval_EvalFrameDefault :
PyErr_Occurred :
PyObject_GenericGetAttr :
PyEval_EvalFrameDefault :
PyErr_Occurred :
PyObject_GenericGetAttr :
PyEval_EvalFrameDefault :
PyObject_GenericGetAttr :
PyEval_EvalFrameDefault :
PyObject_GenericGetAttr :
PyEval_EvalFrameDefault :
PyFunction_FastCallDict :
PyObject_CallFunctionObjArgs :
PyObject_Call :
PyInit_sip :
PyInit_Qsci :
QWidget::event :
QFrame::event :
QAbstractScrollArea::event :
PyInit_Qsci :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QSizePolicy::QSizePolicy :
QSizePolicy::QSizePolicy :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QGuiApplicationPrivate::processKeyEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
CallWindowProcW :
DispatchMessageW :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QCoreApplication::exec :
main :
BaseThreadInitThunk :
RtlUserThreadStart :
</pre>

*QGIS Info*
QGIS Version: 3.2.1-Bonn
QGIS code revision: commit:1edf372fb8
Compiled against Qt: 5.9.2
Running against Qt: 5.9.2
Compiled against GDAL: 2.2.4
Running against GDAL: 2.2.4

*System Info*
CPU Type: x86_64
Kernel Type: winnt
Kernel Version: 10.0.17134

Back