From 8a8fe747294b1f822533f1cbc459c2d89bbe1cb4 Mon Sep 17 00:00:00 2001 From: JiDe Zhang Date: Thu, 21 May 2026 16:40:28 +0800 Subject: [PATCH] fix(vt): avoid repeated VT handlers and restore session state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ensure VT signal handling is connected only once per process. 确保VT信号处理在进程内只连接一次。 Restore Treeland session active state before switching users. 在切换到Treeland管理用户前恢复会话激活状态。 Log: 修复VT切换重复处理与会话状态恢复 Influence: 降低切换到Treeland用户后被拉回或状态不一致的风险。 --- src/daemon/TreelandConnector.cpp | 1 + src/daemon/VirtualTerminal.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/daemon/TreelandConnector.cpp b/src/daemon/TreelandConnector.cpp index 66457f7..ea8e3cb 100644 --- a/src/daemon/TreelandConnector.cpp +++ b/src/daemon/TreelandConnector.cpp @@ -88,6 +88,7 @@ static void renderDisabled([[maybe_unused]] void *data, struct wl_callback *call VirtualTerminal::handleVtSwitches(activeVtFd); close(activeVtFd); + conn->activateSession(); conn->enableRender(); conn->switchToUser(user.isEmpty() ? "dde" : user); } else { diff --git a/src/daemon/VirtualTerminal.cpp b/src/daemon/VirtualTerminal.cpp index b442b43..d605c56 100644 --- a/src/daemon/VirtualTerminal.cpp +++ b/src/daemon/VirtualTerminal.cpp @@ -117,7 +117,8 @@ namespace DDM { daemonApp->signalHandler()->addCustomSignal(RELEASE_DISPLAY_SIGNAL); daemonApp->signalHandler()->addCustomSignal(ACQUIRE_DISPLAY_SIGNAL); - QObject::connect(daemonApp->signalHandler(), &SignalHandler::customSignalReceived, onVtSignal); + QObject::connect(daemonApp->signalHandler(), &SignalHandler::customSignalReceived, + daemonApp->signalHandler(), onVtSignal, Qt::UniqueConnection); return ok; }