[ksmtp] /: Fixup new style invokeMethod() and fix email sending

Luca Beltrame null at kde.org
Tue Jan 9 20:53:25 GMT 2018


Git commit 6e1efd4d524b4ba88edc8f22eb0b4db1b93df121 by Luca Beltrame.
Committed on 09/01/2018 at 20:49.
Pushed by lbeltrame into branch 'master'.

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 at kde.org
CCMAIL: montel at kde.org

M  +6    -0    autotests/fakeserver.cpp
M  +4    -0    src/session.cpp

https://commits.kde.org/ksmtp/6e1efd4d524b4ba88edc8f22eb0b4db1b93df121

diff --git a/autotests/fakeserver.cpp b/autotests/fakeserver.cpp
index f25a56f..dbba154 100644
--- a/autotests/fakeserver.cpp
+++ b/autotests/fakeserver.cpp
@@ -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()
diff --git a/src/session.cpp b/src/session.cpp
index 940ad10..a2a9c83 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -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)



More information about the kde-pim mailing list