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.