Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.4.0
-
None
Description
I've found an issue with QAbstractItemModelTester which reports false-positive result when beginResetModel/endResetModel and fetchMore is used.
A tester is added to the Fetch More Example (https://doc.qt.io/qt-6/qtwidgets-itemviews-fetchmore-example.html) project:
[[maybe_unused]]QAbstractItemModelTester*modelTester=newQAbstractItemModelTester (&m_model,QAbstractItemModelTester::FailureReportingMode::Fatal, this); //modelTester->setUseFetchMore(false); m_model.setDirPath("/home/bv");
On application launch, I get a fault:
Actual (changeInFlight) 5
Expected (ChangeInFlight::None) 0
(/home/qt/work/qt/qtbase/src/testlib/qabstractitemmodeltester.cpp:768)
A debugging process showed me the following:
1. User calls beginResetModel() and the tester sets internal changeInFlight value to ModelReset.
2. User calls endResetModel() and tester calls runAllTests() function.
3. runAllTests calls fetchMore() which calls beginInsertRows().
4. In rowsAboutToBeInserted() slot tester checks if changeInFlight is None (line 768), but it is ModelReset!
If I uncomment "modelTester->setUseFetchMore(false);" string, the bug dissapears.
Files with code are attached.