From 852b1d7b9bcacdb5ce28fab6fba94ec119adda5d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 27 Jun 2015 13:40:05 +0200 Subject: QSharedPointer: make copy assignment from compatible shared pointer use copy-swap ... like all other assignment operators. Removes the last user of internalCopy(). Removed. Change-Id: I15f2cb3b7b26988dd3bc2f4475bc316480476993 Reviewed-by: Thiago Macieira --- src/corelib/tools/qsharedpointer_impl.h | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index b1434b530e..1323dd6b1c 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -362,8 +362,8 @@ public: template inline QSharedPointer &operator=(const QSharedPointer &other) { - QSHAREDPOINTER_VERIFY_AUTO_CAST(T, X); // if you get an error in this line, the cast is invalid - internalCopy(other); + QSharedPointer copy(other); + swap(copy); return *this; } @@ -527,18 +527,6 @@ private: enableSharedFromThis(ptr); } - template - inline void internalCopy(const QSharedPointer &other) - { - Data *o = other.d; - T *actual = other.value; - if (o) - other.ref(); - qSwap(d, o); - qSwap(this->value, actual); - deref(o); - } - void internalSwap(QSharedPointer &other) Q_DECL_NOTHROW { qSwap(d, other.d); -- cgit v1.2.3