diff options
Diffstat (limited to 'src/corelib/tools/qsharedpointer_impl.h')
-rw-r--r-- | src/corelib/tools/qsharedpointer_impl.h | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index db4a0587d2..d22ceb2d69 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -294,7 +294,7 @@ public: QSharedPointer() : value(0), d(0) { } ~QSharedPointer() { deref(); } - inline explicit QSharedPointer(T *ptr) // throws + inline explicit QSharedPointer(T *ptr) : value(ptr) // noexcept { internalConstruct(ptr, &QtSharedPointer::normalDeleter<T>); } template <typename Deleter> @@ -380,7 +380,7 @@ public: static inline QSharedPointer<T> create() { QSharedPointer<T> result(Qt::Uninitialized); - result.internalCreate(); + result.d = QtSharedPointer::ExternalRefCountWithContiguousData<T>::create(&result.value); // now initialize the data new (result.data()) T(); @@ -413,15 +413,9 @@ private: internalFinishConstruction(ptr); } - inline void internalCreate() - { - d = QtSharedPointer::ExternalRefCountWithContiguousData<T>::create(&value); - } - inline void internalFinishConstruction(T *ptr) { - value = ptr; - if (ptr) d->setQObjectShared(ptr, true); + d->setQObjectShared(ptr, true); #ifdef QT_SHAREDPOINTER_TRACK_POINTERS if (ptr) internalSafetyCheckAdd(d, ptr); #endif |