summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlist.h
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-02-21 14:48:47 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-29 16:25:13 +0100
commit2b70a7d25c3e73d02d6d14075790668dcfc16e64 (patch)
tree0429b788d64f98050e371b55f4741e0ce67ba71f /src/corelib/tools/qlist.h
parent737c0a3717a5a52037fe18d664a93d5f6f52a1bc (diff)
QList: have operator= defer to copy-ctor and swap
Change-Id: I0f9bdbc444abfaea35278281b6c1dff4b52c526f Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/corelib/tools/qlist.h')
-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;
}