gui: fix Tread/Tclunk spam after session kill

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.
This commit is contained in:
Levi Neely 2026-08-03 12:28:40 +02:00
parent 0352d3a046
commit 8a0a5e6ff9
1 changed files with 9 additions and 2 deletions

View File

@ -266,6 +266,7 @@ void Ollie9pClient::reconcileAgentConnections()
++it; ++it;
continue; continue;
} }
it.value()->disconnect(this); // prevent stale disconnect signals
it.value()->stop(); it.value()->stop();
it.value()->deleteLater(); it.value()->deleteLater();
m_agentConnected.remove(it.key()); m_agentConnected.remove(it.key());
@ -275,8 +276,10 @@ void Ollie9pClient::reconcileAgentConnections()
void Ollie9pClient::stopAgentConnections() void Ollie9pClient::stopAgentConnections()
{ {
for (NinePConnection *connection : std::as_const(m_agentConnections)) for (NinePConnection *connection : std::as_const(m_agentConnections)) {
connection->disconnect(this);
connection->stop(); connection->stop();
}
qDeleteAll(m_agentConnections); qDeleteAll(m_agentConnections);
m_agentConnections.clear(); m_agentConnections.clear();
} }
@ -389,9 +392,13 @@ bool Ollie9pClient::killSession(const QString &sessionId)
{ {
if (sessionId.isEmpty()) return false; 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) { if (sessionId == m_activeSessionId) {
stopStreams(); stopStreams();
m_activeSessionId.clear();
m_agentId.clear();
emit activeSessionIdChanged();
emit activeAgentIdChanged();
} }
// Use immutable ID — the 9P namespace resolves it via alias. // Use immutable ID — the 9P namespace resolves it via alias.