summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlist.h
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-08-23 13:44:12 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-08-23 17:22:31 +0200
commita2f83283a64460ca26530321f8eb64f3ddfe4c8b (patch)
treec06929f2751f839245bd434b42fbe9fe8de43ee6 /src/corelib/tools/qlist.h
parentd405aa6510514ce02b312994db55c305bde60285 (diff)
Fix assignment of a container included in the container itself
Task-number: QTBUG-13079 Reviewed-by: Joao
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r--src/corelib/tools/qlist.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 722744cc0c..d843cbeb32 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -424,10 +424,11 @@ template <typename T>
Q_INLINE_TEMPLATE QList<T> &QList<T>::operator=(const QList<T> &l)
{
if (d != l.d) {
- l.d->ref.ref();
+ QListData::Data *o = l.d;
+ o->ref.ref();
if (!d->ref.deref())
free(d);
- d = l.d;
+ d = o;
if (!d->sharable)
detach_helper();
}