Bug report #7717

feature setFields crashes

Added by Denis Rouzaud over 6 years ago. Updated over 6 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:Martin Dobias
Category:Vectors
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:16627

Description

Writing

f = QgsFeature()
f.setFields( layer.dataProvider().fields() )

crashes QGIS

Here are the two involved methods

void QgsFeature::setFields  (  const QgsFields *  field  )
virtual const QgsFields& QgsVectorDataProvider::field (   )  const

Something is likely wrong with the ownership. Needs some
investigation

History

#1 Updated by Matthias Kuhn over 6 years ago

Is this related to #7772 and should be closed or is this issue still active?

#2 Updated by Denis Rouzaud over 6 years ago

no, I don't think it's related.

f.setFields( layer.dataProvider().fields() )

crashes, while
fields = layer.dataProvider().fields()
f.setFields( fields )

doesn't

#3 Updated by Matthias Kuhn over 6 years ago

The following does not crash for me on the Python Console of master (Shapefile)

f = QgsFeature()
f.setFields( iface.activeLayer().dataProvider().fields() )

#4 Updated by Denis Rouzaud over 6 years ago

  • Status changed from Open to Closed

yes apparently it does not crash anymore.

Also available in: Atom PDF