Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.9.6, 5.11.1
-
None
-
MacOs homebrew Qt 5.11.1
Gentoo Qt 5.9.6
Description
Creating an empty object in an object, retrieving it for modification creates a memory corruption.
The following code reproduces will randomly segfault (or display a corrupted item):
#include <QJsonObject> #include <QDebug> int main() { QJsonObject parent; QJsonObject child; parent["child"] = child; child = parent["child"].toObject(); // here we should have { "child": { } } child["test"] = "test"; parent.insert("child", child); // here we should have { "child": { "test" : "test" } } qDebug() << parent; }
Note: test fails only if child is an empty object when inserted
Note: test fails only if child is retrieved from parent before being modified
Note: commenting-out Data::compact code in qjson.cpp removes the issue (seems to be related to is_object flag)
Is there any incorrect use of QJsonObject in the above code ?
Attachments
Issue Links
- relates to
-
QTBUG-75324 QJsonObject bug
- Closed