summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-08-23 13:47:21 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-08-23 15:22:31 (GMT)
commit6d8c9c3fddbe1fe0736a015164d5713d49a296d8 (patch)
tree15d4052da17981be9c976efdc96de097f98aab77 /src/corelib/tools
parenta2f83283a64460ca26530321f8eb64f3ddfe4c8b (diff)
downloadQt-6d8c9c3fddbe1fe0736a015164d5713d49a296d8.zip
Qt-6d8c9c3fddbe1fe0736a015164d5713d49a296d8.tar.gz
Qt-6d8c9c3fddbe1fe0736a015164d5713d49a296d8.tar.bz2
Fix assignment of a Q(Explicitly)SharedDataPointer included in the data itself
Task-number: related to QTBUG-13079 Reviewed-by: Joao
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qshareddata.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h
index 7e9934d..6483c90 100644
--- a/src/corelib/tools/qshareddata.h
+++ b/src/corelib/tools/qshareddata.h
@@ -95,9 +95,10 @@ public:
if (o.d != d) {
if (o.d)
o.d->ref.ref();
- if (d && !d->ref.deref())
- delete d;
+ T *old = d;
d = o.d;
+ if (old && !old->ref.deref())
+ delete old;
}
return *this;
}
@@ -105,9 +106,10 @@ public:
if (o != d) {
if (o)
o->ref.ref();
- if (d && !d->ref.deref())
- delete d;
+ T *old = d;
d = o;
+ if (old && !old->ref.deref())
+ delete old;
}
return *this;
}
@@ -174,9 +176,10 @@ public:
if (o.d != d) {
if (o.d)
o.d->ref.ref();
- if (d && !d->ref.deref())
- delete d;
+ T *old = d;
d = o.d;
+ if (old && !old->ref.deref())
+ delete old;
}
return *this;
}
@@ -184,9 +187,10 @@ public:
if (o != d) {
if (o)
o->ref.ref();
- if (d && !d->ref.deref())
- delete d;
+ T *old = d;
d = o;
+ if (old && !old->ref.deref())
+ delete old;
}
return *this;
}