Revert "QWeakPointer: deprecate its relational operators"

This reverts commit bb23a05905.

Reason for revert: this change resulted in a flood of build-breaking
warnings in submodules that need to be cleaned up before we try again.
Also, the discussion following this change shows that this needs more
clarification of the implications and options. Until that is concluded,
the status quo is acceptable.

Change-Id: Id8f67ed585517935c31e29d48099b1c84b787b74
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Volker Hilsheimer 2023-10-25 03:57:14 +00:00
parent 993db5a122
commit 5628600a07

View File

@ -652,36 +652,28 @@ public:
// std::weak_ptr compatibility:
[[nodiscard]] QSharedPointer<T> lock() const { return toStrongRef(); }
#if QT_DEPRECATED_SINCE(6, 7)
template <class X>
QT_DEPRECATED_VERSION_X_6_7("Comparison of QWeakPointers is inconsistent and may lead to crashes. lock() them and then compare the resulting QSharedPointers.")
bool operator==(const QWeakPointer<X> &o) const noexcept
{ return d == o.d && value == static_cast<const T *>(o.value); }
template <class X>
QT_DEPRECATED_VERSION_X_6_7("Comparison of QWeakPointers is inconsistent and may lead to crashes. lock() them and then compare the resulting QSharedPointers.")
bool operator!=(const QWeakPointer<X> &o) const noexcept
{ return !(*this == o); }
template <class X>
QT_DEPRECATED_VERSION_X_6_7("Comparison of QWeakPointers is inconsistent and may lead to crashes. lock() them and then compare the resulting QSharedPointers.")
bool operator==(const QSharedPointer<X> &o) const noexcept
{ return d == o.d; }
template <class X>
QT_DEPRECATED_VERSION_X_6_7("Comparison of QWeakPointers is inconsistent and may lead to crashes. lock() them and then compare the resulting QSharedPointers.")
bool operator!=(const QSharedPointer<X> &o) const noexcept
{ return !(*this == o); }
template <typename X>
QT_DEPRECATED_VERSION_X_6_7("Comparison of QWeakPointers is inconsistent and may lead to crashes. lock() them and then compare the resulting QSharedPointers.")
friend bool operator==(const QSharedPointer<X> &p1, const QWeakPointer &p2) noexcept
{ return p2 == p1; }
template <typename X>
QT_DEPRECATED_VERSION_X_6_7("Comparison of QWeakPointers is inconsistent and may lead to crashes. lock() them and then compare the resulting QSharedPointers.")
friend bool operator!=(const QSharedPointer<X> &p1, const QWeakPointer &p2) noexcept
{ return p2 != p1; }
#endif
friend bool operator==(const QWeakPointer &p, std::nullptr_t)
{ return p.isNull(); }