Skip to content

fix(ddialog): reject on close to avoid accepted() - #764

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0731/bug-371549
Aug 3, 2026
Merged

fix(ddialog): reject on close to avoid accepted()#764
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0731/bug-371549

Conversation

@MyLeeJiEun

@MyLeeJiEun MyLeeJiEun commented Jul 31, 2026

Copy link
Copy Markdown
Contributor
  1. Window close (X button) now calls reject() instead of done(clickedButtonIndex)
  2. Stale button index was misinterpreted as DialogCode, so closing after Confirm emitted accepted() and sent the old password to the auth session
  3. Behavior now matches QDialog::closeEvent: closing the window always means rejection
  4. Cancel button and ESC key paths are unaffected

Log: Window close now always rejects, fixing false accepted() from the stale button index
Influence: X close now rejects, no more false accepted()

fix(ddialog): 关闭窗口时始终拒绝,避免误触发 accepted()

  1. X 关闭时改为调用 reject(),不再用残留的按钮索引
  2. 修复先点确认再点 X 关闭时误触发 accepted()、把旧密码发送给认证会话的问题
  3. 与 QDialog::closeEvent 语义一致:关闭窗口即拒绝
  4. Cancel 按钮与 ESC 键路径不受影响

Log: 窗口关闭(X 按钮)始终走 reject,修复残留按钮索引误触发 accepted() 的问题
PMS: BUG-371549
Influence: 修复鉴权框点 X 关闭误发密码、误触发 accepted() 的问题

Summary by Sourcery

Bug Fixes:

  • Fix dialog close via the window X button incorrectly emitting accepted() due to a stale clicked button index.

@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.

Sorry @MyLeeJiEun, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@sourcery-ai

sourcery-ai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR updates DDialog’s close handling so that closing via the window’s X button consistently rejects the dialog instead of completing it using a stale clicked button index, aligning behavior with QDialog::closeEvent and preventing false accepted() signals.

Sequence diagram for updated DDialog closeEvent rejection behavior

sequenceDiagram
    actor User
    participant WindowManager
    participant DDialog

    User->>WindowManager: clickXButton
    WindowManager->>DDialog: closeEvent(event)
    DDialog->>DDialog: Q_EMIT aboutToClose()
    DDialog->>DDialog: reject()
    DDialog->>DDialog: Q_EMIT visibleChanged(isVisible())
    DDialog->>DDialog: Q_EMIT closed()
Loading

File-Level Changes

Change Details Files
Change dialog close behavior to always reject when the window is closed via the X button, eliminating use of stale button index and false accepted() emissions.
  • Replace the closeEvent handler’s call to done() with a call to reject() when the window close event occurs
  • Ensure closing the dialog via the X button no longer relies on d->clickedButtonIndex, preventing misinterpretation as an accepted result
  • Align DDialog’s window-close semantics with QDialog::closeEvent so that closing the window is treated as rejection
src/widgets/ddialog.cpp

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

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

Hi @MyLeeJiEun. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mhduiy
mhduiy requested a review from 18202781743 July 31, 2026 08:32
18202781743
18202781743 previously approved these changes Aug 3, 2026
1. Window close (X button) now calls reject() instead of done(clickedButtonIndex)
2. Stale button index was misinterpreted as DialogCode, so closing after Confirm emitted accepted() and sent the old password to the auth session
3. Behavior now matches QDialog::closeEvent: closing the window always means rejection
4. Cancel button and ESC key paths are unaffected

Log: Window close now always rejects, fixing false accepted() from the stale button index
Influence: X close now rejects, no more false accepted()

fix(ddialog): 关闭窗口时始终拒绝,避免误触发 accepted()

1. X 关闭时改为调用 reject(),不再用残留的按钮索引
2. 修复先点确认再点 X 关闭时误触发 accepted()、把旧密码发送给认证会话的问题
3. 与 QDialog::closeEvent 语义一致:关闭窗口即拒绝
4. Cancel 按钮与 ESC 键路径不受影响

Log: 窗口关闭(X 按钮)始终走 reject,修复残留按钮索引误触发 accepted() 的问题
PMS: BUG-371549
Influence: 修复鉴权框点 X 关闭误发密码、误触发 accepted() 的问题
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, MyLeeJiEun

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

@MyLeeJiEun

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit dede12c into linuxdeepin:master Aug 3, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants