Bug report #13806

Using QgsAttributeTableModel makes QGIS crash

Added by Luiz Andrade over 1 year ago. Updated over 1 year 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

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, 11/11/2015 05:48 AM

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

History

#1 Updated by Giovanni Manghi over 1 year ago

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

#2 Updated by Sandro Santilli over 1 year ago

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

#3 Updated by Sandro Santilli over 1 year 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 1 year ago

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

Also available in: Atom PDF