diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index b1434b530e6..1323dd6b1c3 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);