Bug report #11704
Adding valid layer but not in QgsMapLayerRegistry to QgsLayerTreeGroup crashes QGIS 2.6
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | Martin Dobias | ||
Category: | - | ||
Affected QGIS version: | 2.6.0 | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | duplicate |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 19946 |
Description
This is a bit related to #11703
If we add a valid layer, but that layer is not registered in QgsMapLayerRegistry, this will crash QGIS 2.6.
A simple scenario, select any vector layer first and run this:
layer = iface.activeLayer() layer_group = QgsLayerTreeGroup() layer_group.addLayer(layer) <-- THIS IS FINE print layer_group.dump() new_layer = QgsVectorLayer(layer.source(), layer.name(), 'ogr') layer_group.addLayer(new_layer) <- NOOOOOOOOO THE CRASH PART print layer_group.dump()
History
#1 Updated by Akbar Gumbira about 10 years ago
layer = iface.activeLayer() layer_group = QgsLayerTreeGroup() layer_group.addLayer(layer) # <-- THIS IS FINE print layer_group.dump() new_layer = QgsVectorLayer(layer.source(), layer.name(), 'ogr') layer_group.addLayer(new_layer) # <- NOOOOOOOOO THE CRASH PART print layer_group.dump()
#2 Updated by Tim Sutton almost 10 years ago
- Assignee changed from Tim Sutton to Martin Dobias
#3 Updated by Martin Dobias almost 10 years ago
- Resolution set to duplicate
- Status changed from Open to Closed
The same thing as #11703