From 944221001c67d01fc528f5e7a0d3b1c9578cec32 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 4 Jun 2012 18:52:36 +0200 Subject: Fixed QJsonObject::find() The function returns mutable iterator on the object that can later be passed to e.g. erase(), hence it should detach() to be consistent with QJsonObject::begin() which also detaches. Change-Id: Id79e8e012fd5469e06b68fbc9eecb7c6848ce9c1 Reviewed-by: Lars Knoll Reviewed-by: Denis Dzyubenko --- src/corelib/json/qjsonobject.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/json') diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index 5439855b90..8801e9c96d 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -452,6 +452,7 @@ QJsonObject::iterator QJsonObject::find(const QString &key) int index = o ? o->indexOf(key, &keyExists) : 0; if (!keyExists) return end(); + detach(); return iterator(this, index); } -- cgit v1.2.3