Bug report #7268

Master crashes after a typo in API: QgsMapLayerRegistry.removeMapLayers( int )

Added by Borys Jurgiel about 11 years ago. Updated almost 11 years ago.

Category:Python plugins
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.


#1 Updated by Alexander Bruy about 11 years ago

  • Status changed from Open to Closed
  • Resolution set to fixed

There is now removeMapLayer() method (in addition to removeMapLayers()) that accepts single layer ID, so I close this issue.

#2 Updated by Borys Jurgiel about 11 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 :) )

#3 Updated by Borys Jurgiel about 11 years ago

  • Resolution deleted (fixed)

#4 Updated by Matthias Kuhn almost 11 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?

Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: QgsMapLayerRegistry.removeMapLayers(QStringList): argument 1 has unexpected type 'int'

#5 Updated by Borys Jurgiel almost 11 years ago

  • Resolution set to fixed
  • Status changed from Feedback to Closed

Seems it's fixed in the meantime.

Also available in: Atom PDF