rduivenvoorde / temp

0 stars 0 forks source link

Python Console crashes when removing non-existent vector layer #18

Open rduivenvoorde opened 8 years ago

rduivenvoorde commented 8 years ago

Imported from Redmine: http://hub.qgis.org/issues/10755 Originally created on Mon Jun 30 02:16:22 -0700 2014, last update on Sat Nov 07 06:02:05 -0800 2015 Author: @rduivenvoorde rduivenvoorde@foo.bar (Q: should we show email?, Q: should we create @ mention?)

Description

When I try to run the following code (included in attachment crash.py) from Python Console, the QGis crashes by saying:

minidump written to C:\Users\rauni\AppData\Local\Temp\qgis-20140630-120940-6060-5464-8fdd08a.dmp (see attached minidump)

However, if I run the code (included in attachment no_crash.py), then no error occurs.

Code is following:

 iface = qgis.utils.iface

 rasterLayer = iface.addRasterLayer("crs=EPSG:4326&dpiMode=7&featureCount=10&format=image/png&layers=natura2000&styles=&url=http://geodata.nationaalgeoregister.nl/natura2000/ows", "wms master example", "wms" ) 
 vectorLayer = iface.addVectorLayer("http://geodata.nationaalgeoregister.nl/bestuurlijkegrenzen/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=bestuurlijkegrenzen:provincies&SRSNAME=EPSG:28992","wfs example","WFS")

 #QgsMapLayerRegistry.instance().addMapLayer(vectorLayer) #if this line is commented out, a crash occurs.

 # additional code...

 QgsMapLayerRegistry.instance().removeMapLayer(vectorLayer.id())

I am using the versions: QGIS versioon 2.4.0-Chugiak QGIS koodi revisjon 8fdd08a Kompileeritud Qt-le 4.8.5 Töötab Qt-s 4.8.5 Kompileeritud GDAL/OGR-le 1.11.0 Töötab GDAL/OGR-s 1.11.0 Compiled against GEOS 3.4.2-CAPI-1.8.2 Running against GEOS 3.4.2-CAPI-1.8.2 r3921 PostgreSQL kliendi versioon 9.2.4 SpatiaLite versioon 4.1.1 QWT versioon 5.2.3 PROJ.4 Versioon 480 QScintilla2 Version 2.7.2

I am using Windows 7, if it matters.

Attachments

crash.py - crash file. Rauni Lillemets, 06/30/2014 02:16 am crash.py.zip

no_crash.py - no crash occurs. Rauni Lillemets, 06/30/2014 02:16 am no_crash.py.zip

Related

Issue #17

rduivenvoorde commented 8 years ago

History from Redmine

Rauni Lillemets 06/30/2014 02:17 am

File qgis-20140630-120940-6060-5464-8fdd08a.zip added qgis-20140630-120940-6060-5464-8fdd08a.zip

Matthias Kuhn, m-kuhn

Crashes here only in the following order:

rasterLayer = iface.addRasterLayer("crs=EPSG:4326&dpiMode=7&featureCount=10&format=image/png&layers=natura2000&styles=&url=http://geodata.nationaalgeoregister.nl/natura2000/ows", "wms master example", "wms" ) 
vectorLayer = iface.addVectorLayer("http://geodata.nationaalgeoregister.nl/bestuurlijkegrenzen/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=bestuurlijkegrenzen:provincies&SRSNAME=EPSG:28992","wfs example","WFS")

QgsMapLayerRegistry.instance().removeMapLayer(vectorLayer.id())
QgsMapLayerRegistry.instance().addMapLayer(vectorLayer) #if this line is commented out, a crash occurs.
QgsMapLayerRegistry.instance().removeMapLayer(vectorLayer.id())

Giovanni Manghi

Category set to PyQGIS Console (mapped to label: 5 CAT: PyQGIS) Priority changed from Normal to High (mapped to label: 3 PRIO: High) Causes crash or corruption changed from No to Yes (mapped to label: 3 PRIO: Severe/Regression)

Jürgen Fischer

Matthias Kuhn wrote:

Crashes here only in the following order:

[...]

More detailed:

So that's a flaw in the API and a duplicate of #777.

But @crash.py@ doesn't use the layer after it has been removed and doesn't crash here on master.

Status changed from Open to Feedback

Jürgen Fischer

Subject changed from Python Console crashes when removing non-existant vector layer to Python Console crashes when removing non-existent vector layer

Giovanni Manghi

Should we close this as duplicate?

Jürgen Fischer

Status changed from Feedback to Closed Resolution set to duplicate