QHostInfo: fix remaining slotObj leaks
We failed to delete the slot object when lookUpHost() was called in these (exceptional) circumstances: - on a thread with no event dispatcher - after application shut-down, when the QHostInfoLookupManager Q_APPLICATION_STATIC was destroyed already Fix by adding the missing destroyIfLastRef() calls into these code paths, too. Amends ad5eb297e179a164e297a7c2eb3b9674a1196605. This would be so much easier if we had SlotObjUniquePtr... Task-number: QTBUG-115263 Change-Id: Ief8bf125bc196742c0ce59c1fd87ab93242fc0da Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 693c9e6b1b2f160862a7490af78072a244fa5b9f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
a92ee82651
commit
ee09dbe13d
@ -742,6 +742,8 @@ int QHostInfo::lookupHostImpl(const QString &name,
|
||||
|
||||
if (!QAbstractEventDispatcher::instance(QThread::currentThread())) {
|
||||
qWarning("QHostInfo::lookupHost() called with no event dispatcher");
|
||||
if (slotObj)
|
||||
slotObj->destroyIfLastRef();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -802,6 +804,8 @@ int QHostInfo::lookupHostImpl(const QString &name,
|
||||
QObject::connect(&runnable->resultEmitter, SIGNAL(resultsReady(QHostInfo)),
|
||||
receiver, member, Qt::QueuedConnection);
|
||||
manager->scheduleLookup(runnable);
|
||||
} else if (slotObj) {
|
||||
slotObj->destroyIfLastRef();
|
||||
}
|
||||
#endif // Q_OS_WASM
|
||||
return id;
|
||||
|
Loading…
x
Reference in New Issue
Block a user