diff options
-rw-r--r-- | src/corelib/tools/qsharedpointer_impl.h | 7 |
1 files changed, 4 insertions, 3 deletions
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<T> &operator=(const QSharedPointer<T> &other) { - internalCopy(other); + QSharedPointer copy(other); + swap(copy); return *this; } #ifdef Q_COMPILER_RVALUE_REFS inline QSharedPointer<T> &operator=(QSharedPointer<T> &&other) { - QSharedPointer<T>::internalSwap(other); + swap(other); return *this; } #endif @@ -372,7 +373,7 @@ public: } #endif - inline void clear() { *this = QSharedPointer<T>(); } + inline void clear() { QSharedPointer copy; swap(copy); } QWeakPointer<T> toWeakRef() const; |