summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/tools/qlist.h9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 08dedb4e94..798351cd61 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -419,13 +419,8 @@ template <typename T>
Q_INLINE_TEMPLATE QList<T> &QList<T>::operator=(const QList<T> &l)
{
if (d != l.d) {
- QListData::Data *o = l.d;
- o->ref.ref();
- if (!d->ref.deref())
- dealloc(d);
- d = o;
- if (!d->sharable)
- detach_helper();
+ QList<T> tmp(l);
+ tmp.swap(*this);
}
return *this;
}