projects
/
profile
/
ivi
/
qtbase.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
737c0a3
)
QList: have operator= defer to copy-ctor and swap
author
João Abecasis
<joao.abecasis@nokia.com>
Tue, 21 Feb 2012 13:48:47 +0000
(14:48 +0100)
committer
Qt by Nokia
<qt-info@nokia.com>
Wed, 29 Feb 2012 15:25:13 +0000
(16:25 +0100)
Change-Id: I0f9bdbc444abfaea35278281b6c1dff4b52c526f
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
src/corelib/tools/qlist.h
patch
|
blob
|
history
diff --git
a/src/corelib/tools/qlist.h
b/src/corelib/tools/qlist.h
index
08dedb4
..
798351c
100644
(file)
--- 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;
}