Bug report #13806

Using QgsAttributeTableModel makes QGIS crash

Added by Luiz Andrade over 1 year ago. Updated about 1 year ago.

Status:Closed Start Date:11/11/2015
Priority:High Due date:
Assigned to:- % Done:

0%

Category:Python plugins and bindings
Target version:Version 2.14
Platform: Pull Request or Patch supplied:No
Platform version: Affected version:2.12.0
Status info: Causes crash or corruption:Yes
Resolution:fixed/implemented Tag:

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 (3.2 kB) Luiz Andrade, 11/11/2015 05:48 am

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

History

Updated by Giovanni Manghi over 1 year ago

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

Updated by Sandro Santilli about 1 year ago

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

Updated by Sandro Santilli about 1 year ago

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

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.

Updated by Luiz Andrade about 1 year ago

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

Also available in: Atom