diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-10-26 14:53:47 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-10-26 15:15:55 (GMT) |
commit | 2d750192e73244f5b4ad6b451f264728d42669be (patch) | |
tree | 53616ffcc129e0568b4d6585ae1c554b7eda7061 /src/sql | |
parent | 9c78eb972041a066e455bf04d63f3290afacb982 (diff) | |
download | Qt-2d750192e73244f5b4ad6b451f264728d42669be.zip Qt-2d750192e73244f5b4ad6b451f264728d42669be.tar.gz Qt-2d750192e73244f5b4ad6b451f264728d42669be.tar.bz2 |
Fixed crash when setting header data in QSqlQueryModel.
The crash (Q_ASSERT_X failure) happened when a proxy model was being attached
to the QSqlQueryModel, and no query was set yet. The headerDataChanged()
signal was being received by the proxy model who wouldn't check its
"proxyfied" data bounds.
The patch introduces a behaviour change. However, this change makes the usage
of QSqlQueryModel::setHeaderData() to be more in accordance with the current
documentation, and to behave in the same way as for QStandardItemModel,
QTreeModel, and QTableModel.
Task-number: QTBUG-4963
Reviewed-by: Olivier
Diffstat (limited to 'src/sql')
-rw-r--r-- | src/sql/models/qsqlquerymodel.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp index a72ad8c..1719239 100644 --- a/src/sql/models/qsqlquerymodel.cpp +++ b/src/sql/models/qsqlquerymodel.cpp @@ -417,7 +417,7 @@ bool QSqlQueryModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) { Q_D(QSqlQueryModel); - if (orientation != Qt::Horizontal || section < 0) + if (orientation != Qt::Horizontal || section < 0 || columnCount() <= section) return false; if (d->headers.size() <= section) |