[SocketApi] Ensure listener still exists

This commit is contained in:
Hannah von Reth 2020-03-18 16:07:50 +01:00 committed by Kevin Ottens
parent 868b05f25b
commit 12ae1e97c6
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2

View file

@ -388,8 +388,10 @@ void SocketApi::slotReadSocket()
}
} else {
if (indexOfMethod != -1) {
// to ensure that listener is still valid we need to call it with Qt::DirectConnection
ASSERT(thread() == QThread::currentThread())
staticMetaObject.method(indexOfMethod)
.invoke(this, Qt::QueuedConnection, Q_ARG(QString, argument),
.invoke(this, Qt::DirectConnection, Q_ARG(QString, argument),
Q_ARG(SocketListener *, listener));
} else {
qCWarning(lcSocketApi) << "The command is not supported by this version of the client:" << command << "with argument:" << argument;