Bug report #13806

Using QgsAttributeTableModel makes QGIS crash

Added by Luiz Andrade about 9 years ago. Updated over 8 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Python plugins
Affected QGIS version:2.12.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:Yes Copied to github as #:21831

Description

I'm using a slot to show layer attributes as follows:

@pyqtSlot(int)
def on_layerCombo_currentIndexChanged(self):
if self.layerCombo.currentIndex() == 0:
return
currentLayerName = self.layerCombo.currentText()
currentLayer = None
layers = self.iface.mapCanvas().layers()
for layer in layers:
if layer.name() == currentLayerName:
currentLayer = layer
break
cache = QgsVectorLayerCache(currentLayer, 10)
model = QgsAttributeTableModel(cache)
model.loadLayer()
self.tableView.setModel(model)

The problem is, every time a refresh event happens on my table QGIS crashes.

attributes_viewer.py Magnifier (3.18 KB) Luiz Andrade, 2015-11-11 05:48 AM

attributes_viewer.ui (997 Bytes) Luiz Andrade, 2015-11-11 05:48 AM

History

#1 Updated by Giovanni Manghi about 9 years ago

  • Category set to Python plugins
  • Priority changed from Normal to High

#2 Updated by Sandro Santilli almost 9 years ago

Luiz could you please test with current master branch ? Some fixes have gone into QgsAttributeTable

#3 Updated by Sandro Santilli almost 9 years ago

  • Status changed from Open to Closed
  • Resolution set to fixed/implemented
  • Target version set to Version 2.14

Assuming fixed (also assuming 8 days are enough for anyone to give feedback to a ticket).
Feel free to reopen if still experiencing this bug.

#4 Updated by Luiz Andrade over 8 years ago

Sorry for the late response. No problems anymore so far. Thank you very much!

Also available in: Atom PDF