[qt/qt/qt5compat]: Summary of bulk changes made
KDE Git Services - Bulk Change <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git repository change summary for qt/qt/qt5compat
Pushed by mirror-service into branch 'dev'.
Changed from 31877d54da29fa862fc17918c61ed43fd201eb19 to 5bf03da5cee39efe5b583662eb17bf5d02524cb7
Acknowledgement was received that this change introduces only existing code that has been pushed to another public open source repository.
This change contains the following new commits:
Git commit 82604842849a66554baac66ef4f4a4469f62d848 by Ivan Solovev on 17/08/2026 at 08:07..
Fix memleak in QBinaryJson::to{Raw,Binary}Data()
In Qt 5, the code belonged to QJsonDocument, and the memory was managed
by QJsonDocumentPrivate, which correctly cleaned it up in the d-tor.
However, when moved to Qt5Compat in Qt 6, the code simply became a
namespace with a bunch of free functions, so the underlying d-ptr is
gone. As a result, QBinaryJson::toRawData() simply hands a pointer to
the user, and it's now their responsibility to free the memory.
In case of QBinaryJson::toBinaryData(), the pointer is used to construct
a QByteArray (which did another copy), and was never freed afterwards.
That's a memory leak on the Qt side.
This patch fixes the memleak in QBinaryJson::toBinaryData(), and also
documents that the user has to free the memory obtained from
QBinaryJson::toRawData(). It also adds a qWarning() to the toRawData()
function, to steer the users towards toBinaryData() usage.
A follow-up patch will deprecate toRawData() immediately in 6.12.
Since toRawData() was used in toBinaryData() implementation, the
patch introduces a new static toRawDataHelper() that actually contains
all the logic.
The tests are also fixed to avoid memory leaks.
Amends the introduction of the code in Qt5Compat repo (Qt 6.0).
Fixes: QTBUG-149054
Pick-to: 6.12 6.11 6.8 6.5
Change-Id: If376d19f9788c753e29fd237abf7849307491504
Reviewed-by: Thiago Macieira <[email protected]>
https://invent.kde.org/qt/qt/qt5compat/-/commit/82604842849a66554baac66ef4f4a4469f62d848
Git commit f90f59e7447ff56fe816ac67370603a20de6b6f2 by Ivan Solovev on 17/08/2026 at 08:07..
Deprecate QBinaryJson::toRawData() immediately in 6.12
This method is not safe, with no clear path to make it behave like in
Qt 5 again, see below. Deprecate it in favor of the memory-safe
alternative.
[ChangeLog][Deprecation Notice][QBinaryJson] Deprecated the toRawData()
method, because the returned memory has to be manually released by the
user, in stark contrast to Qt 5, where it remained owned by the object.
A backward-compatible alternative is to use toBinaryData() instead.
Task-number: QTBUG-149054
Pick-to: 6.12
Change-Id: I59f9e38bb6b4031320160ab2617802e8cc59b89e
Reviewed-by: Marc Mutz <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
https://invent.kde.org/qt/qt/qt5compat/-/commit/f90f59e7447ff56fe816ac67370603a20de6b6f2
Git commit 5bf03da5cee39efe5b583662eb17bf5d02524cb7 by Marc Mutz on 17/08/2026 at 08:51..
Enable strict mode 6.12 in qt5compat
No code changes necessary, the "not yet in strict mode" set already in
.cmake.conf was exactly the diff between strict mode 6.11 and 6.12.
Pick-to: 6.12
Change-Id: I27433f473e4ab9988e7cf8dfec621fb69e5f450d
Reviewed-by: Ivan Solovev <[email protected]>
https://invent.kde.org/qt/qt/qt5compat/-/commit/5bf03da5cee39efe5b583662eb17bf5d02524cb7