fix(vt): avoid repeated VT handlers and restore session state#92
Conversation
Ensure VT signal handling is connected only once per process. 确保VT信号处理在进程内只连接一次。 Restore Treeland session active state before switching users. 在切换到Treeland管理用户前恢复会话激活状态。 Log: 修复VT切换重复处理与会话状态恢复 Influence: 降低切换到Treeland用户后被拉回或状态不一致的风险。
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: zccrs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideEnsures VT custom signal handling is connected only once per process and restores the Treeland session active state before switching to the Treeland-managed user, reducing repeated VT handling and inconsistent session state after user switching. Sequence diagram for Treeland session activation before user switchsequenceDiagram
participant RenderDisabled as renderDisabled
participant VirtualTerminal as VirtualTerminal
participant TreelandConnector as TreelandConnector
RenderDisabled->>VirtualTerminal: handleVtSwitches(activeVtFd)
RenderDisabled->>RenderDisabled: close(activeVtFd)
RenderDisabled->>TreelandConnector: activateSession()
RenderDisabled->>TreelandConnector: enableRender()
RenderDisabled->>TreelandConnector: switchToUser(user)
Sequence diagram for VT customSignalReceived unique connectionsequenceDiagram
participant DaemonApp as DaemonApp
participant SignalHandler as SignalHandler
participant VirtualTerminal as VirtualTerminal
DaemonApp->>SignalHandler: addCustomSignal(RELEASE_DISPLAY_SIGNAL)
DaemonApp->>SignalHandler: addCustomSignal(ACQUIRE_DISPLAY_SIGNAL)
DaemonApp->>SignalHandler: connect(customSignalReceived, onVtSignal, UniqueConnection)
SignalHandler->>VirtualTerminal: customSignalReceived(RELEASE_DISPLAY_SIGNAL)
VirtualTerminal->>VirtualTerminal: onVtSignal(RELEASE_DISPLAY_SIGNAL)
SignalHandler-->>VirtualTerminal: customSignalReceived(ACQUIRE_DISPLAY_SIGNAL)
VirtualTerminal->>VirtualTerminal: onVtSignal(ACQUIRE_DISPLAY_SIGNAL)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review这段代码修改涉及两个文件: 1. 文件:
|
There was a problem hiding this comment.
Pull request overview
This PR targets VT switching stability in ddm by preventing repeated VT signal handler connections and ensuring the Treeland session is re-activated before switching to a Treeland-managed user, reducing inconsistent session state after VT transitions.
Changes:
- Use
Qt::UniqueConnection(with an explicit context object) to avoid duplicate connections toSignalHandler::customSignalReceivedin VT handling. - Restore Treeland session active state (
activateSession()) beforeenableRender()/switchToUser()when switching to a VT running Treeland.
上述改动主要提升 ddm 在 VT 切换场景下的稳定性:避免 VT 信号处理重复连接,并在切换到 Treeland 管理的用户前恢复会话激活状态,从而降低 VT 切换后会话状态不一致的风险。
变更点:
- 在 VT 处理逻辑中使用
Qt::UniqueConnection(并显式指定 context 对象)避免对SignalHandler::customSignalReceived的重复连接。 - 当切换到正在运行 Treeland 的 VT 时,在
enableRender()/switchToUser()前调用activateSession()恢复会话激活状态。
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/daemon/VirtualTerminal.cpp |
Prevent duplicate Qt signal connections for VT custom-signal handling via Qt::UniqueConnection. / 通过 Qt::UniqueConnection 避免 VT 自定义信号处理的重复 Qt 连接。 |
src/daemon/TreelandConnector.cpp |
Activate Treeland session before rendering/user switch during VT transition to Treeland. / 在切换到 Treeland 的 VT 流程中先激活会话再恢复渲染并切换用户。 |
| 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); |
Ensure VT signal handling is connected only once per process.
确保VT信号处理在进程内只连接一次。
Restore Treeland session active state before switching users.
在切换到Treeland管理用户前恢复会话激活状态。
Log: 修复VT切换重复处理与会话状态恢复
Influence: 降低切换到Treeland用户后被拉回或状态不一致的风险。
Summary by Sourcery
Ensure VT signal handling is only connected once per process and restore session activation before switching to the Treeland-managed user.
Bug Fixes: