Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
6.7.0
-
None
-
89b6ad3ab (dev), 6bce1ddec (6.6), a7f0c65a5 (6.5)
Description
This is the converting constructor for QWeakPointer from rvalues:
template <class X, IfCompatible<X> = true> Q_NODISCARD_CTOR QWeakPointer(QWeakPointer<X> &&other) noexcept : d(other.d), value(other.value) { other.d = nullptr; other.value = nullptr; }
This is wrong, because doing value(other.value) may require access other.value's vtable (in the presence of virtual inheritance). We need to lock() and access only if it's safe.
Strangely, this protection is already employed by the converting assignment operator.
(Just so that I can quote this problem in commit messages.)
Attachments
For Gerrit Dashboard: QTBUG-117483 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
506667,5 | QWeakPointer: fix the converting constructor from rvalues | dev | qt/qtbase | Status: MERGED | +2 | 0 |
507106,2 | QWeakPointer: fix the converting constructor from rvalues | 6.6 | qt/qtbase | Status: MERGED | +2 | 0 |
507109,2 | QWeakPointer: fix the converting constructor from rvalues | 6.5 | qt/qtbase | Status: MERGED | +2 | 0 |