Skip to content

fix: restore sessions before showing the greeter - #123

Merged
wineee merged 1 commit into
linuxdeepin:masterfrom
gugullll:fix/password_err
Nov 16, 2026
Merged

wineee merged 1 commit into
linuxdeepin:masterfrom
gugullll:fix/password_err

Conversation

@gugullll

@gugullll gugullll commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

根因:
Treeland 单独重启后,DDM 和原用户会话仍可能存活。重连时,旧代码会先发 ShowGreeter,再发 UserLoggedIn。如果用户在这个窗口提交密码,Treeland 会因 loggedIn 尚未恢复而误发 Login。DDM 发现已有认证会话后直接返回,界面就会一直等待。
现在 DDM 先发送所有 UserLoggedIn,再发送 ShowGreeter,让 Treeland 在正常重连显示界面前恢复会话状态,避免这条路径误发 Login。

  1. Buffer UserLoggedIn and ShowGreeter in the same SocketWriter.
  2. Deliver existing session state before displaying the greeter.
  3. Let Treeland use Unlock for existing sessions after a reconnect.

Log: Fix incorrect login requests while restoring sessions on reconnect.

Influence:

  1. Reconnect with existing sessions and check that UserLoggedIn arrives first.
  2. Re-enter the password for an existing session and check that it unlocks.
  3. Start the greeter without existing sessions and check that it appears.

fix: 显示登录界面前先恢复已有会话

  1. 使用同一个 SocketWriter 缓冲 UserLoggedIn 和 ShowGreeter。
  2. 先同步已有会话状态,再显示登录界面。
  3. Treeland 重连后可对已有会话发送 Unlock 请求。

Log: 修复重连恢复会话期间可能误发登录请求的问题。

Influence:

  1. 保留已有会话并重连 greeter,确认先收到 UserLoggedIn。
  2. 为已有会话重新输入密码,确认可以解锁。
  3. 在没有已有会话时启动 greeter,确认登录界面正常显示。

PMS: BUG-383137

Summary by Sourcery

Restore existing sessions before showing the greeter during reconnects.

Bug Fixes:

  • Ensure existing session state is delivered before displaying the greeter when reconnecting.
  • Allow existing sessions to be unlocked after a greeter reconnect instead of issuing incorrect login requests.

1. Buffer UserLoggedIn and ShowGreeter in the same SocketWriter.
2. Deliver existing session state before displaying the greeter.
3. Let Treeland use Unlock for existing sessions after a reconnect.

Log: Fix incorrect login requests while restoring sessions on reconnect.

Influence:
1. Reconnect with existing sessions and check that UserLoggedIn arrives first.
2. Re-enter the password for an existing session and check that it unlocks.
3. Start the greeter without existing sessions and check that it appears.

fix: 显示登录界面前先恢复已有会话

1. 使用同一个 SocketWriter 缓冲 UserLoggedIn 和 ShowGreeter。
2. 先同步已有会话状态,再显示登录界面。
3. Treeland 重连后可对已有会话发送 Unlock 请求。

Log: 修复重连恢复会话期间可能误发登录请求的问题。

Influence:
1. 保留已有会话并重连 greeter,确认先收到 UserLoggedIn。
2. 为已有会话重新输入密码,确认可以解锁。
3. 在没有已有会话时启动 greeter,确认登录界面正常显示。

PMS: BUG-383137
@sourcery-ai

sourcery-ai Bot commented Nov 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Reuse the existing SocketWriter for ShowGreeter so it is buffered with UserLoggedIn and delivered afterward.

  • src/daemon/Display.cpp L253

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次变更修复了在显示登录界面(greeter)前恢复会话的顺序问题。代码通过复用已有的 writer 对象替代新建 SocketWriter 来发送 ShowGreeter 消息,确保消息通过同一写入器 发送,修复了会话恢复与 greeter 显示的时序问题。变更简洁、逻辑正确,四维度均无问题。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

当前代码已为最佳实现,无需额外修复示例。复用已有 writer 对象发送 ShowGreeter 消息是正确的做法: ```cpp writer << quint32(DaemonMessages::ShowGreeter); ```

本报告由 AI 代码审查工具自动生成

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: gugullll, zccrs

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@wineee
wineee merged commit 2f7f5bb into linuxdeepin:master Nov 16, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants