From 8627161524f49d4d2730d298f5184b5d1eb970b9 Mon Sep 17 00:00:00 2001 From: Naomi Kirby Date: Wed, 18 Dec 2024 12:04:54 -0800 Subject: [PATCH] Ignore local socket disconnect in initialization state This seems to be a bug in the daemon recovery logic. The initialization steps starts with a QLocalSocket::abort() to clear the socket state and this can sometimes generate a disconnect signal, treating disconnection as an error can result in an infinite loop. --- src/localsocketcontroller.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/localsocketcontroller.cpp b/src/localsocketcontroller.cpp index 3400a303af..767ecf85d5 100644 --- a/src/localsocketcontroller.cpp +++ b/src/localsocketcontroller.cpp @@ -50,7 +50,11 @@ LocalSocketController::LocalSocketController(const QString& path) connect(m_socket, &QLocalSocket::connected, this, &LocalSocketController::daemonConnected); connect(m_socket, &QLocalSocket::disconnected, this, - [&] { errorOccurred(QLocalSocket::PeerClosedError); }); + [&] { + if (m_daemonState != eInitializing) { + errorOccurred(QLocalSocket::PeerClosedError); + } + }); connect(m_socket, &QLocalSocket::errorOccurred, this, &LocalSocketController::errorOccurred); connect(m_socket, &QLocalSocket::readyRead, this,