diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 6dc5764e87..db4a0587d2 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -305,13 +305,14 @@ public: { if (d) ref(); } inline QSharedPointer &operator=(const QSharedPointer &other) { - internalCopy(other); + QSharedPointer copy(other); + swap(copy); return *this; } #ifdef Q_COMPILER_RVALUE_REFS inline QSharedPointer &operator=(QSharedPointer &&other) { - QSharedPointer::internalSwap(other); + swap(other); return *this; } #endif @@ -372,7 +373,7 @@ public: } #endif - inline void clear() { *this = QSharedPointer(); } + inline void clear() { QSharedPointer copy; swap(copy); } QWeakPointer toWeakRef() const;