Bug report #7268
Master crashes after a typo in API: QgsMapLayerRegistry.removeMapLayers( int )
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Yes||Copied to github as #:||16285|
Master crashes when I accidentally pass a single id (instead of a list) to QgsMapLayerRegistry.removeMapLayers()
Looks like a simple validation issue. I mark as a blocker, as it may be potentially a common mistake.
#2 Updated by Borys Jurgiel over 8 years ago
- Status changed from Closed to Reopened
I decided to reopen it as I believe QGIS shouldn't crash just because of typos in scripts. It doesn't cost much CPU to validate the datatype, and it can save one's work after a small typo in the Python Console (and QGIS reputation as well :) )
#4 Updated by Matthias Kuhn over 8 years ago
- Status changed from Reopened to Feedback
- Priority changed from Severe/Regression to Normal
The following excerpt from the python console did not generate a crash.
I don't see, where this could have been fixed, but maybe it is connected to the SIP version? Which version are you using?
QgsMapLayerRegistry.instance().removeMapLayers(1) Traceback (most recent call last): File "<input>", line 1, in <module> TypeError: QgsMapLayerRegistry.removeMapLayers(QStringList): argument 1 has unexpected type 'int' QgsMapLayerRegistry.instance().removeMapLayers(['1']) QgsMapLayerRegistry.instance().removeMapLayers('1')