From d3db0c7e5044dc4507c82ed8f371ca8c324ac639 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Mon, 5 Jul 2021 23:35:39 +0200 Subject: QXmppStream: Fix memory leak in new IqState The code needs to be improved here. --- src/base/QXmppStream.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/base/QXmppStream.cpp') diff --git a/src/base/QXmppStream.cpp b/src/base/QXmppStream.cpp index 56f3afda..af4280fc 100644 --- a/src/base/QXmppStream.cpp +++ b/src/base/QXmppStream.cpp @@ -54,12 +54,12 @@ class IqState : public QFutureInterface Q_DISABLE_COPY(IqState) public: - IqState(QFuture sendFuture, bool streamManagementUsed) + IqState(QFuture sendFuture, bool streamManagementUsed, QObject *parent) : QFutureInterface(QFutureInterfaceBase::Started), m_sendFuture(std::move(sendFuture)), m_streamManagementUsed(streamManagementUsed) { - auto *watcher = new QFutureWatcher(); + auto *watcher = new QFutureWatcher(parent); QObject::connect(watcher, &QFutureWatcher::finished, [=]() { const auto result = watcher->future().results().last(); @@ -254,7 +254,7 @@ QFuture QXmppStream::sendIq(const QXmppIq &iq) return sendIq(newIq); } - auto *interface = new IqState(send(iq), d->streamManager.enabled()); + auto *interface = new IqState(send(iq), d->streamManager.enabled(), this); if (!interface->isFinished()) { d->runningIqs.insert(iq.id(), interface); -- cgit v1.2.3