Bug report #11790
Python bindings for QgsDxfExport.addLayers causes crash
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | - | ||
Category: | Python plugins | ||
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 |
Description
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.
Associated revisions
History
#1 Updated by Giovanni Manghi over 7 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
Hi,
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.
#2 Updated by Giovanni Manghi over 7 years ago
- Status changed from Feedback to Open
- Description updated (diff)
#3 Updated by Giovanni Manghi over 7 years ago
- Easy fix? set to No
- Regression? set to No
#4 Updated by Iain Lopata about 7 years ago
I can confirm that this is still an issue in 2.18.13
#5 Updated by Giovanni Manghi about 7 years ago
- Affected QGIS version changed from 2.4.0 to 2.18.13
#6 Updated by Denis Rouzaud almost 7 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset qgis|c2baf1b91b7c0a34e2c1e6c31169a1eb34f8eb94.
#7 Updated by Giovanni Manghi over 6 years ago
- Resolution set to fixed/implemented