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 ad5eb297e1
.
This would be so much easier if we had SlotObjUniquePtr...
Pick-to: 6.6 6.5 6.2 5.15
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>
This commit is contained in:
parent
47a0282707
commit
693c9e6b1b
@ -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…
Reference in New Issue
Block a user