summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qhash.h
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-08-23 11:44:12 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-08-23 15:22:31 (GMT)
commita2f83283a64460ca26530321f8eb64f3ddfe4c8b (patch)
treec06929f2751f839245bd434b42fbe9fe8de43ee6 /src/corelib/tools/qhash.h
parentd405aa6510514ce02b312994db55c305bde60285 (diff)
downloadQt-a2f83283a64460ca26530321f8eb64f3ddfe4c8b.zip
Qt-a2f83283a64460ca26530321f8eb64f3ddfe4c8b.tar.gz
Qt-a2f83283a64460ca26530321f8eb64f3ddfe4c8b.tar.bz2
Fix assignment of a container included in the container itself
Task-number: QTBUG-13079 Reviewed-by: Joao
Diffstat (limited to 'src/corelib/tools/qhash.h')
-rw-r--r--src/corelib/tools/qhash.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 0777f06..c7e4bc1 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -589,10 +589,11 @@ template <class Key, class T>
Q_INLINE_TEMPLATE QHash<Key, T> &QHash<Key, T>::operator=(const QHash<Key, T> &other)
{
if (d != other.d) {
- other.d->ref.ref();
+ QHashData *o = other.d;
+ o->ref.ref();
if (!d->ref.deref())
freeData(d);
- d = other.d;
+ d = o;
if (!d->sharable)
detach_helper();
}