fix(treeland): activate session before unlocking#103
Conversation
Treeland 解锁已有用户 session 时,原流程先调用UnlockSession(sessionId), 再调用 activateSession(user, sessionId)。这会让 logind Unlock 信号有机 会先于 Treeland activation 到达,使 Treeland 仍按旧 active session判断 unlock 目标,并可能把目标 session 重新锁回去。 本次仅调整 Treeland session 的解锁顺序:先通知 Treeland 激活目标 user 再调用 logind UnlockSession(sessionId)。非 Treeland session 仍保持原来 的 unlock 后切 VT 流程不变,避免影响 X11/Wayland 其它路径 Log: Fix Treeland unlock ordering during user switch PMS: BUG-346587 Influence: Affects DDM Treeland user switching and unlock flow
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: zorowk 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 GuideAdjusts the unlock and activation ordering for Treeland sessions so Treeland activates the target user session before logind unlocks it, while preserving the existing VT-switch flow for non-Treeland sessions. Sequence diagram for updated Treeland vs non-Treeland session unlock orderingsequenceDiagram
actor User
participant Display as DDM_Display
participant Treeland
participant Logind
participant Seatd
User ->> Display: auth successful
alt auth->type == Treeland
Display ->> Treeland: activateSession(user, xdgSessionId)
Display ->> Logind: UnlockSession(xdgSessionId)
else auth->type != Treeland
Display ->> Logind: UnlockSession(xdgSessionId)
Display ->> Seatd: requestSwitchVt(tty)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider extracting
QString::number(auth->xdgSessionId)into a local variable and/or consolidating theUnlockSessioncall to avoid duplication between the Treeland and non-Treeland branches.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider extracting `QString::number(auth->xdgSessionId)` into a local variable and/or consolidating the `UnlockSession` call to avoid duplication between the Treeland and non-Treeland branches.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 当前代码已为最佳实践,无需修改,此处展示当前最终形态
namespace DDM {
OrgFreedesktopLogin1ManagerInterface manager(Logind::serviceName(),
Logind::managerPath(),
QDBusConnection::systemBus());
if (auth->type == Treeland) {
activateSession(user, auth->xdgSessionId);
manager.UnlockSession(QString::number(auth->xdgSessionId));
} else {
manager.UnlockSession(QString::number(auth->xdgSessionId));
if (!daemonApp->seatdControl()->requestSwitchVt(auth->tty))
qWarning() << "Failed to switch to session VT" << auth->tty << "for user" << user;
}
qInfo() << "Successfully identified user" << user;
return;
} |
Treeland 解锁已有用户 session 时,原流程先调用UnlockSession(sessionId), 再调用 activateSession(user, sessionId)。这会让 logind Unlock 信号有机 会先于 Treeland activation 到达,使 Treeland 仍按旧 active session判断 unlock 目标,并可能把目标 session 重新锁回去。
本次仅调整 Treeland session 的解锁顺序:先通知 Treeland 激活目标 user 再调用 logind UnlockSession(sessionId)。非 Treeland session 仍保持原来 的 unlock 后切 VT 流程不变,避免影响 X11/Wayland 其它路径
Log: Fix Treeland unlock ordering during user switch PMS: BUG-346587
Influence: Affects DDM Treeland user switching and unlock flow
Summary by Sourcery
Bug Fixes: