From 8a0a5e6ff9eb539fd944be9b4790f9ad6cc6c56d Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Mon, 3 Aug 2026 12:28:40 +0200 Subject: [PATCH] gui: fix Tread/Tclunk spam after session kill MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three fixes: 1. Disconnect signals before stopping removed connections in reconcileAgentConnections — prevents disconnect->refresh loop. 2. Clear m_activeSessionId/m_agentId when killing the active session — guard function returns false, statewait stream stops. 3. Same disconnect-before-stop in stopAgentConnections. --- gui/ollie9pclient.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gui/ollie9pclient.cpp b/gui/ollie9pclient.cpp index 6e348df..4efcb22 100644 --- a/gui/ollie9pclient.cpp +++ b/gui/ollie9pclient.cpp @@ -266,6 +266,7 @@ void Ollie9pClient::reconcileAgentConnections() ++it; continue; } + it.value()->disconnect(this); // prevent stale disconnect signals it.value()->stop(); it.value()->deleteLater(); m_agentConnected.remove(it.key()); @@ -275,8 +276,10 @@ void Ollie9pClient::reconcileAgentConnections() void Ollie9pClient::stopAgentConnections() { - for (NinePConnection *connection : std::as_const(m_agentConnections)) + for (NinePConnection *connection : std::as_const(m_agentConnections)) { + connection->disconnect(this); connection->stop(); + } qDeleteAll(m_agentConnections); m_agentConnections.clear(); } @@ -389,9 +392,13 @@ bool Ollie9pClient::killSession(const QString &sessionId) { if (sessionId.isEmpty()) return false; - // If killing the active session, shut down its streams first + // If killing the active session, shut down its streams and deselect. if (sessionId == m_activeSessionId) { stopStreams(); + m_activeSessionId.clear(); + m_agentId.clear(); + emit activeSessionIdChanged(); + emit activeAgentIdChanged(); } // Use immutable ID — the 9P namespace resolves it via alias.