QList: have operator= defer to copy-ctor and swap

Change-Id: I0f9bdbc444abfaea35278281b6c1dff4b52c526f
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
This commit is contained in:
João Abecasis 2012-02-21 14:48:47 +01:00 committed by Qt by Nokia
parent 737c0a3717
commit 2b70a7d25c

View File

@ -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;
}