Bug report #20694

QgsVectorLayer 's addFeatures function crashes the app

Added by Mehmet Selim BILGIN over 1 year ago.

Status:Open
Priority:Normal
Assignee:-
Category:Python bindings / sipify
Affected QGIS version:3.4.1 Regression?:No
Operating System:Linux Mint 19 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:28514

Description

I generated Spatialite point layer that has 1M features by using random point plugin. In python I tried to copy all features to memory layer. Here is the sample code:

sourceFeatures = self.sourceLayer.getSelectedFeatures()
self.targetLayer.startEditing()
self.targetLayer.addFeatures(sourceFeatures)
---crashed---

But when i try with 10.000 features this time it successfully adds features. Interestingly, I tried to add 1M features with while loop, this time it succeed. And note that adding operation runs on another QThread.

Also available in: Atom PDF