summaryrefslogtreecommitdiffstats
path: root/src/corelib/json/qjsonvalue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/json/qjsonvalue.cpp')
-rw-r--r--src/corelib/json/qjsonvalue.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp
index b21f59ae35..718dfa43b3 100644
--- a/src/corelib/json/qjsonvalue.cpp
+++ b/src/corelib/json/qjsonvalue.cpp
@@ -275,25 +275,11 @@ QJsonValue::QJsonValue(const QJsonValue &other)
*/
QJsonValue &QJsonValue::operator =(const QJsonValue &other)
{
- if (t == String && stringData && !stringData->ref.deref())
- free(stringData);
-
- t = other.t;
- dbl = other.dbl;
-
- if (d != other.d) {
-
- if (d && !d->ref.deref())
- delete d;
- d = other.d;
- if (d)
- d->ref.ref();
-
- }
-
- if (t == String && stringData)
- stringData->ref.ref();
-
+ QJsonValue copy(other);
+ // swap(copy);
+ qSwap(dbl, copy.dbl);
+ qSwap(d, copy.d);
+ qSwap(t, copy.t);
return *this;
}