Commit 08bdf758 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Fix connection threads cleanup on server shutdown

parent e023874c
......@@ -304,9 +304,7 @@ bool AkonadiServer::quit()
mAlreadyShutdown = true;
qCDebug(AKONADISERVER_LOG) << "terminating connection threads";
for (int i = 0; i < mConnections.count(); ++i) {
delete mConnections[i];
}
qDeleteAll(mConnections);
mConnections.clear();
qCDebug(AKONADISERVER_LOG) << "terminating service threads";
......@@ -352,10 +350,11 @@ void AkonadiServer::newCmdConnection(quintptr socketDescriptor)
return;
}
QPointer<Connection> connection = new Connection(socketDescriptor);
connect(connection.data(), &Connection::disconnected,
this, [connection]() {
delete connection.data();
Connection *connection = new Connection(socketDescriptor);
connect(connection, &Connection::disconnected,
this, [this, connection]() {
delete connection;
mConnections.removeOne(connection);
}, Qt::QueuedConnection);
mConnections.append(connection);
}
......
......@@ -100,7 +100,7 @@ protected:
ItemRetrievalManager *mItemRetrieval;
SearchTaskManager *mAgentSearchManager;
QProcess *mDatabaseProcess;
QVector<QPointer<Connection>> mConnections;
QVector<Connection *> mConnections;
SearchManager *mSearchManager;
bool mAlreadyShutdown;
......
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