Commit e5a4689e authored by David Faure's avatar David Faure
Browse files

Fix 10s wait when an akonadi session is deleted after QCoreApp is deleted.

This happened to me in a new unittest for messageviewer, due to
several other issues, which I'll fix, but still we can handle the
situation more gracefully here (and warn, to simplify future debugging)
parent 312e5a7f
......@@ -65,7 +65,14 @@ ConnectionThread::ConnectionThread(const QByteArray &sessionId, QObject *parent)
QMetaObject::invokeMethod(this, "doThreadQuit");
if (QCoreApplication::instance()) {
QMetaObject::invokeMethod(this, "doThreadQuit");
} else {
// QCoreApplication already destroyed -> invokeMethod would just not get the message delivered
// We leak the socket, but at least we don't block for 10s
qWarning() << "Akonadi ConnectionThread deleted after QCoreApplication is destroyed. Clean up your sessions earlier!";
if (!thread()->wait(10 * 1000)) {
// Make sure to wait until it's done, otherwise it can crash when the pthread callback is called
Supports Markdown
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