Review Request 128575: KRearrangeColumnsProxyModel: fix assert when running against debug build of Qt
Daniel Vrátil
dvratil at kde.org
Tue Aug 2 12:45:35 UTC 2016
> On Aug. 2, 2016, 2:24 p.m., David Faure wrote:
> > I'll write a corresponding unittest. Why was the source index invalid? rowCount==0 in the source model?
Yes, the source model was empty.
- Daniel
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128575/#review97996
-----------------------------------------------------------
On Aug. 2, 2016, 2:14 p.m., Daniel Vrátil wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128575/
> -----------------------------------------------------------
>
> (Updated Aug. 2, 2016, 2:14 p.m.)
>
>
> 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/0f57ce48/attachment.html>
More information about the Kde-frameworks-devel
mailing list