Review Request 128575: KRearrangeColumnsProxyModel: fix assert when running against debug build of Qt

Daniel Vrátil dvratil at kde.org
Tue Aug 2 18:16:00 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128575/
-----------------------------------------------------------

(Updated Aug. 2, 2016, 6:15 p.m.)


Status
------

This change has been discarded.


Review request for KDE Frameworks and David Faure.


Repository: kitemmodels


Description
-------

When Qt is built in debug mode, QAbstractItemModel::setModel() will invoke a Q_ASSERT that unconditionally queries index of the first row of the model:

    Q_ASSERT_X(d->model->index(0,0) == d->model->index(0,0),
               "QAbstractItemView::setModel",
               "A model should return the exact same index "
               "(including its internal id/pointer) when asked for it twice in a row.");

This breaks the assumption in the KRearrangeColumnsProxyModel::index() that when queried for a valid index, the source model must be able to provide a valid index as well.

This patch simply removes the Q_ASSERT from KRearrangeColumnsProxyModel::index() and instead returns an invalid QModelIndex, as expected.


Diffs
-----

  src/krearrangecolumnsproxymodel.cpp 72e4f14 

Diff: https://git.reviewboard.kde.org/r/128575/diff/


Testing
-------

Triggered by Kleopatra on start, no more assert with this patch.


Thanks,

Daniel Vrátil

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20160802/512efbdf/attachment.html>


More information about the Kde-frameworks-devel mailing list