Details
Description
When deserializing some types (QList, QLinkedList, QSet) using QDataStream::startTransaction and QDataStream::commitTransaction, in some cases commitTransaction returns true whereas the full container could not be read. It happens when the bytes available for read stop at an exact boundary between two items of the container.
This is because QDataStream has the following test between each item deserialization :
if (s.atEnd())
break;
Then nothing is read from the datastream, so the status never goes to ReadPastEnd, and the transaction commits successfully.
The current workaround is to simply add a qint8 after the container, so that its deserialization switches the datastream status to ReadPastEnd.
Attachments
For Gerrit Dashboard: QTBUG-54022 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
162527,14 | QDataStream: unify deserialization of containers | 5.7 | qt/qtbase | Status: MERGED | +2 | 0 |
162860,5 | QDataStream: adjust containers' deserialization in transaction mode | 5.7 | qt/qtbase | Status: MERGED | +2 | 0 |
164365,1 | QDataStream: unify deserialization of containers | dev | qt/qtbase | Status: ABANDONED | 0 | 0 |