summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-08-06 09:46:52 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-08-10 14:50:04 (GMT)
commitca8d92f1d30b1519ccbfdab44e3868e9556b3fb5 (patch)
treefb8646d6342572222d3b6aaa604c33ea4b6c13e8 /src
parent99fd5825dfb4d50cff93165995701a65b7a8e4ed (diff)
downloadQt-ca8d92f1d30b1519ccbfdab44e3868e9556b3fb5.zip
Qt-ca8d92f1d30b1519ccbfdab44e3868e9556b3fb5.tar.gz
Qt-ca8d92f1d30b1519ccbfdab44e3868e9556b3fb5.tar.bz2
Optimize QSharedPointer::operator=(const QSharedPointer &)
internalSet check that stringref is > 0 Which is not required as we do not assign from a QWeakPointer Reviewed-by: Thiago Task-number: QTBUG-12700
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index dd27f7e..7f0de5f 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -387,7 +387,13 @@ namespace QtSharedPointer {
template <class X>
inline void internalCopy(const ExternalRefCount<X> &other)
{
- internalSet(other.d, other.data());
+ Data *o = other.d;
+ T *actual = other.value;
+ if (o)
+ other.ref();
+ qSwap(d, o);
+ qSwap(this->value, actual);
+ deref(o, actual);
}
inline void internalSwap(ExternalRefCount &other)