From 763790bb5c4423952daf97ed0194db8db1ea1a3b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 8 Mar 2012 10:41:55 +0100 Subject: Fix a bug in the assignment operators for QJsonObject and Array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When objects or arrays where being used read only, several objects can share the same d pointer, but will have different pointers into the binary data. Correctly change the pointer into the binary data even if the d-pointer is the same. Change-Id: Ife0ea5ac5daf46586f855dccdf35b51ec696a623 Reviewed-by: João Abecasis --- src/corelib/json/qjsonarray.cpp | 2 +- src/corelib/json/qjsonobject.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/json') diff --git a/src/corelib/json/qjsonarray.cpp b/src/corelib/json/qjsonarray.cpp index 433a68105d..6bae2001a1 100644 --- a/src/corelib/json/qjsonarray.cpp +++ b/src/corelib/json/qjsonarray.cpp @@ -122,10 +122,10 @@ QJsonArray &QJsonArray::operator =(const QJsonArray &other) if (d && !d->ref.deref()) delete d; d = other.d; - a = other.a; if (d) d->ref.ref(); } + a = other.a; return *this; } diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index cfe71e8959..e14000fac3 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -125,10 +125,10 @@ QJsonObject &QJsonObject::operator =(const QJsonObject &other) if (d && !d->ref.deref()) delete d; d = other.d; - o = other.o; if (d) d->ref.ref(); } + o = other.o; return *this; } -- cgit v1.2.3