Skip to content

Fix ChangeRecorder journal corruption due to qsizetype change in Qt6

The serialization code that writes into the journal file does not explicitly cast the return type of QList::count() to a specific type. The code that loads from the journal file then assumes the type is 'int' and loads the serialized value as 'int'. In Qt6 the return type of QList::count() has changed from 'int' to 'qsizetype', which is 8 bytes on x64, so suddenly the writer and loader disagree on the types and the reader reads fewer bytes than it needs to. This leads to ChangeRecorder not being able to properly restore notifications from journal.

To preserve compatiblity with journals written by Qt5-based Akonadi, we cast the QList::count() result to 'int'.

Long-term, we need a more future-proof code for the journal than the current hand-crafted one.

Merge request reports