Bug report #11790
Python bindings for QgsDxfExport.addLayers causes crash
|Affected QGIS version:||2.18.13||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||Yes||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||Yes||Copied to github as #:||20016|
I try to use QgsDxfExport from python but failed adding vector layers using addLayers method. I tried passing argument as a list of lists or a list of tuples, but both makes qgis crashes.
It seems like SIP doesn't like QList<QPair<QgsVectorLayer*,int>> argument type : help(QgsDxfExport) in python console reports "QgsDxfExport.addLayers(unknown-type)".
Because I don't know how to make SIP recognize this type as a python list of tuples, I simply add a "addLayer" method as :
void QgsDxfExport::addLayer( QgsVectorLayer *layer, int featureID )
mLayers.append(QPair< QgsVectorLayer *, int >(layer, featureID));
Using this method, I successfully exported in DXF from python.
Attached a patch for the 3 concerned files : QgsDxfExport.cpp, QgsDxfExport.h and QgsDxfExport.sip.
#1 Updated by Giovanni Manghi over 4 years ago
- Crashes QGIS or corrupts data changed from No to Yes
- Status changed from Open to Feedback
- Priority changed from Normal to High
- Target version deleted (
Future Release - Nice to have)
- Affected QGIS version changed from master to 2.4.0
what is the status of this issue? Is the patch still necessary in the latest QGIS releases like 2.18.4 or was already submitted and committed?
I have to change the "affected version" tag because now master is used for qgis3/master, and as 2 years old issue this is likely to have affected master that then become 2.6 or something like that.