Details
Description
QDirIterator::hasNext is the usual way to detect iterator exhaustion, but QDirIterator documentation says that ::next will return an empty string upon exhaustion. In Qt 5 and up to 6.5.3 at least, this was true, so a loop controlled by while (it.next() != "") terminated normally. In 6.8.3, that loop runs forever, with it.next() repeatedly returning the last filename ad infinitum, contrary to documentation at https://doc.qt.io/qt-6/qdiriterator.html#next.
Naturally, code should be using it.hasNext(), but either your documentation or your library needs to change, as this is an apparent regression failure that could impact existing products as they upgrade to Qt 6.8.
This bug is observed on macOS and Windows, but likely occurs on all platforms.
Minimal example is attached.
Attachments
Issue Links
- relates to
-
QTBUG-130142 6.8 Regresssion: QDirIterator::next segfaults
-
- Closed
-
For Gerrit Dashboard: QTBUG-135287 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
636177,1 | QDirIterator: next() should return empty string after reaching the end | 6.8 | qt/qtbase | Status: NEW | +2 | 0 |