Details
-
Suggestion
-
Resolution: Duplicate
-
P4: Low
-
None
-
4.0.1, 5.6, 5.7, 5.8, 5.9, 5.10.1, 5.11.0 Beta 1
-
None
Description
QSharedDataPointer doesn't implement
friend bool operator==(T *a, QSharedDataPointer<T> const &b) const
and
friend bool operator==(QSharedDataPointer<T> const &a, T *b) const
Because of this, the shared pointer detaches on
ptrInst == nullptr
Example:
QSharedDataPointer<int> ptrInst(new int(-1)); QSharedDataPointer<int> secondInst = ptrInst; // ref() bool isNull; isNull = !ptrInst; // ok, no detach() isNull = ptrInst == nullptr; // NOT OK, detaches!
Attachments
Issue Links
- is replaced by
-
QTBUG-66635 QSharedDataPointer detaches in unexpected situations
-
- Closed
-