Fixup new style invokeMethod() and fix email sending

The original code used sendData(data) but that just threw the
resource in an infinite loop. It should have used the one from m_thread.
Doing so fixes email sending properly.

Many thanks to Fabian Vogt for spotting the issue.

CCMAIL: kde-pim@kde.org
CCMAIL: montel@kde.org
parent 3a07df62
......@@ -59,7 +59,13 @@ void FakeServer::startAndWait()
{
start();
// this will block until the event queue starts
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
QMetaObject::invokeMethod(this, &FakeServer::started, Qt::BlockingQueuedConnection);
#else
QMetaObject::invokeMethod(this, "started", Qt::BlockingQueuedConnection);
#endif
}
void FakeServer::dataAvailable()
......
......@@ -261,8 +261,12 @@ void SessionPrivate::setState(Session::State s)
void SessionPrivate::sendData(const QByteArray &data)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
QMetaObject::invokeMethod(m_thread, [this, data] { m_thread->sendData(data); }, Qt::QueuedConnection);
#else
QMetaObject::invokeMethod(m_thread, "sendData",
Qt::QueuedConnection, Q_ARG(QByteArray, data));
#endif
}
void SessionPrivate::responseReceived(const ServerResponse &r)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment