summaryrefslogtreecommitdiffstats
path: root/src/network/kernel/qhostinfo_p.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-07-21 12:32:53 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-08-06 11:33:03 +0000
commita9982a3b637e482c52a1ca97f9e235eb302048c3 (patch)
tree5117da43b6011e492bb4dec83fb325dbd51695ac /src/network/kernel/qhostinfo_p.h
parent5bb4020cbe3ce0619d6046708b677469415de850 (diff)
Add copy(SlotObjUniquePtr), use it in QHostInfoResult & SlotObjSharedPtr
It's a free function, because a) it rhymes with move(ptr) and, of course, SlotObjUniquePtr being a std::unique_ptr, b) we can't add member functions to it (and no, inheriting from a type whose dtor is neither protected nor virtual is nothing you will catch yours truly doing). Pick-to: 6.6 6.5 Change-Id: I2026126857a7bba204d683bad118e8a2c5cb2924 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/network/kernel/qhostinfo_p.h')
-rw-r--r--src/network/kernel/qhostinfo_p.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index d883a33cdd..6b755ab0c2 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -61,11 +61,9 @@ protected:
private:
QHostInfoResult(const QHostInfoResult *other)
- : receiver(other->receiver), slotObj(other->slotObj.get()), // ugly, but copy the pointer...
+ : receiver(other->receiver), slotObj{copy(other->slotObj)},
withContextObject(other->withContextObject)
{
- if (slotObj)
- slotObj->ref(); // ... and ref it here
// cleanup if the application terminates before results are delivered
connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit,
this, &QObject::deleteLater);