summaryrefslogtreecommitdiffstats
path: root/src/corelib/json/qjson_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-03-29 12:25:09 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-29 16:08:40 +0200
commit698b33fccebbd1cb4094fdf8dc681108824530f5 (patch)
tree888f82aa06204095cb8a6023e79447a023a84caf /src/corelib/json/qjson_p.h
parent19109a7697c786253563c97d102dc69f7dce002d (diff)
Properly detach when the modified object is a sub object
The clone() method didn't detach if we had enough memory allocated, but didn't consider that the object being modified is not the root object of the binary blob. Change-Id: I9a479ae1c873b7fe9cff7e13c539e7a41961bf68 Reviewed-by: Cristiano di Flora <cristiano.di-flora@nokia.com> Reviewed-by: abcd <amos.choy@nokia.com> Reviewed-by: Jamey Hicks <jamey.hicks@nokia.com>
Diffstat (limited to 'src/corelib/json/qjson_p.h')
-rw-r--r--src/corelib/json/qjson_p.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h
index f8f41c2e25..831774e456 100644
--- a/src/corelib/json/qjson_p.h
+++ b/src/corelib/json/qjson_p.h
@@ -745,7 +745,7 @@ public:
Data *clone(Base *b, int reserve = 0)
{
int size = sizeof(Header) + b->size;
- if (ref.load() == 1 && alloc >= size + reserve)
+ if (b == header->root() && ref.load() == 1 && alloc >= size + reserve)
return this;
if (reserve) {