ui: fixed crash while refreshing views

There was a problem while refreshing and reconfiguring the views'
columns, which caused segfaults.
This commit is contained in:
Gustavo Iñiguez Goia 2023-10-18 11:19:08 +02:00
parent 174c63c3ff
commit 1b26acbd21
Failed to generate hash of commit

View file

@ -68,6 +68,10 @@ class GenericTableModel(QStandardItemModel):
# set columns based on query's fields
def setModelColumns(self, newColumns):
# Avoid firing signals while reconfiguring the view, it causes
# segfaults.
self.blockSignals(True);
self.headerLabels = []
self.removeColumns(0, self.lastColumnCount)
self.setHorizontalHeaderLabels(self.headerLabels)
@ -77,6 +81,8 @@ class GenericTableModel(QStandardItemModel):
self.setHorizontalHeaderLabels(self.headerLabels)
self.setColumnCount(len(self.headerLabels))
self.blockSignals(False);
def setQuery(self, q, db):
self.origQueryStr = q
self.db = db