Skip to content

fix: defer ThreadExecXrandr to async in MainWindow init - #978

Draft
pengfeixx wants to merge 1 commit into
linuxdeepin:masterfrom
pengfeixx:agent/bugfix/368943
Draft

pengfeixx wants to merge 1 commit into
linuxdeepin:masterfrom
pengfeixx:agent/bugfix/368943

Conversation

@pengfeixx

@pengfeixx pengfeixx commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

fix: defer ThreadExecXrandr to async in MainWindow init

  1. Root cause: MainWindow constructor synchronously blocked the UI
    thread with ThreadExecXrandr before show() was called, causing
    incomplete window rendering on slow xrandr/DBus response
  2. Fix: wrap ThreadExecXrandr calls in QTimer::singleShot(0, ...) in
    both constructor and slotListItemClicked to defer execution until
    after show() and event loop startup
  3. Impact: monitorNumber detection logic preserved, only execution
    timing changed from sync to async; window renders immediately

Log: fix incomplete device manager window rendering on slow platforms

Influence:

  1. Test window opens with complete UI rendering on Loongson 3A6000
  2. Test left menu item clicks load device info without UI freeze
  3. Test monitor number change detection still triggers refresh

fix: 延迟 MainWindow 中 ThreadExecXrandr 为异步执行

  1. 根因:MainWindow 构造函数在 show() 之前同步阻塞 UI 线程执行
    ThreadExecXrandr,当 xrandr/DBus 慢响应时导致窗口渲染不完整
  2. 方案:在构造函数和 slotListItemClicked 中使用
    QTimer::singleShot(0, ...) 包装 ThreadExecXrandr 调用,
    将阻塞调用延迟到 show() 后事件循环启动时执行
  3. 影响:monitorNumber 检测逻辑保留不变,仅执行时序从同步改为
    异步,窗口可及时渲染

Log: 修复慢响应平台上设备管理器窗口显示不全的问题

Influence:

  1. 在龙芯 3A6000 平台测试窗口打开后界面完整显示
  2. 测试左侧菜单项点击时设备信息加载无卡顿
  3. 测试显示器数量变化检测仍能正常触发刷新

PMS: BUG-368943

Summary by Sourcery

Defer monitor detection during window initialization and item selection so the device-manager UI renders responsively on slow platforms.

Bug Fixes:

  • Prevent incomplete device-manager window rendering by deferring monitor detection until after the UI event loop starts.
  • Keep monitor-count change detection and device-information refresh behavior intact while avoiding synchronous UI blocking.

1. Root cause: MainWindow constructor synchronously blocked the UI
   thread with ThreadExecXrandr before show() was called, causing
   incomplete window rendering on slow xrandr/DBus response
2. Fix: wrap ThreadExecXrandr calls in QTimer::singleShot(0, ...) in
   both constructor and slotListItemClicked to defer execution until
   after show() and event loop startup
3. Impact: monitorNumber detection logic preserved, only execution
   timing changed from sync to async; window renders immediately

Log: fix incomplete device manager window rendering on slow platforms

Influence:
1. Test window opens with complete UI rendering on Loongson 3A6000
2. Test left menu item clicks load device info without UI freeze
3. Test monitor number change detection still triggers refresh

fix: 延迟 MainWindow 中 ThreadExecXrandr 为异步执行

1. 根因:MainWindow 构造函数在 show() 之前同步阻塞 UI 线程执行
   ThreadExecXrandr,当 xrandr/DBus 慢响应时导致窗口渲染不完整
2. 方案:在构造函数和 slotListItemClicked 中使用
   QTimer::singleShot(0, ...) 包装 ThreadExecXrandr 调用,
   将阻塞调用延迟到 show() 后事件循环启动时执行
3. 影响:monitorNumber 检测逻辑保留不变,仅执行时序从同步改为
   异步,窗口可及时渲染

Log: 修复慢响应平台上设备管理器窗口显示不全的问题

Influence:
1. 在龙芯 3A6000 平台测试窗口打开后界面完整显示
2. 测试左侧菜单项点击时设备信息加载无卡顿
3. 测试显示器数量变化检测仍能正常触发刷新

PMS: BUG-368943
@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: pengfeixx

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

@sourcery-ai

sourcery-ai Bot commented Nov 13, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Defer both monitor-count checks until the event loop runs so xrandr/DBus waits do not block initial display or menu-item handling.

  • deepin-devicemanager/src/Page/MainWindow.cpp L139-145, L656, L671

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-bot

deepin-bot Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

TAG Bot

New tag: 6.0.77
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #990

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.

3 participants