Commit bb249705 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Fix crash on shutdown

parent 0f675259
......@@ -330,14 +330,20 @@ void AkonadiServer::incomingConnection(quintptr socketDescriptor)
if (mAlreadyShutdown) {
return;
}
QPointer<Connection> connection = new Connection(socketDescriptor);
connect(connection.data(), &Connection::disconnected,
this, [connection]() {
delete connection.data();
}, Qt::QueuedConnection);
Connection *connection = new Connection(socketDescriptor);
connect(connection, &Connection::disconnected,
this, &AkonadiServer::connectionDisconnected);
mConnections.append(connection);
}
void AkonadiServer::connectionDisconnected()
{
auto conn = qobject_cast<Connection*>(sender());
mConnections.removeOne(conn);
delete conn;
}
AkonadiServer *AkonadiServer::instance()
{
if (!s_instance) {
......
......@@ -68,6 +68,7 @@ public Q_SLOTS:
private Q_SLOTS:
void doQuit();
void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
void connectionDisconnected();
protected:
/** reimpl */
......
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