diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-09-22 11:56:44 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-12-06 08:24:44 +0200 |
commit | d42b901ae4f0aa618ca66009ea79d72720b37380 (patch) | |
tree | 97409d2d47a1bcbf979e8b2ee03aac1a2ebef64d /src/corelib/tools/qsharedpointer_impl.h | |
parent | 25d1db424e3bd00d5c008168ee4cb735d88ed9ac (diff) |
QSharedPointer: Remove support code for tracking weak-pointer
In Qt 6, it is no longer possible to create a weak pointer from a plain
QObject pointer.
Consequently, we don't need the work-aronuds introduced for QTBUG-22622.
Except that we still need to keep the functions as they are exported.
Mark them as QT6_ONLY, so that they'll be gone automatically come Qt 6.
Amends e40320c552a9ccd4c1879a4da13c8d909b2cd21e.
Change-Id: I568da04008374c891a111eee49f6679dabdfdee4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qsharedpointer_impl.h')
-rw-r--r-- | src/corelib/tools/qsharedpointer_impl.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 73e39f0b91..456be91d03 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -116,8 +116,10 @@ namespace QtSharedPointer { #ifndef QT_NO_QOBJECT Q_CORE_EXPORT static ExternalRefCountData *getAndRef(const QObject *); + QT6_ONLY( Q_CORE_EXPORT void setQObjectShared(const QObject *, bool enable); - Q_CORE_EXPORT void checkQObjectShared(const QObject *); + ) + QT6_ONLY(Q_CORE_EXPORT void checkQObjectShared(const QObject *);) #endif inline void checkQObjectShared(...) { } inline void setQObjectShared(...) { } @@ -499,7 +501,6 @@ private: #ifdef QT_SHAREDPOINTER_TRACK_POINTERS internalSafetyCheckAdd(d, ptr); #endif - d->setQObjectShared(ptr, true); enableSharedFromThis(ptr); } @@ -527,12 +528,10 @@ private: tmp = o->strongref.loadRelaxed(); // failed, try again } - if (tmp > 0) { + if (tmp > 0) o->weakref.ref(); - } else { - o->checkQObjectShared(actual); + else o = nullptr; - } } qt_ptr_swap(d, o); |