Skip to content

Conversation

@18202781743
Copy link
Contributor

平台插件中判断_NET_KDE_COMPOSITE_TOGGLING是否为0,如果是0就不做处理

Log: 修复Qt 的 XCB 后端 GetProperty 有大量的 "BadAtom" 错误
Bug: https://pms.uniontech.com/bug-view-237955.html
Influence: X11下应用日志 xcb"badatom"报错
Change-Id: I9620627f5b41c2a609d4df490eacdce802417a7f

@18202781743 18202781743 requested review from BLumia and mhduiy October 17, 2025 07:56
deepin-ci-robot added a commit to linuxdeepin/qt6platform-plugins that referenced this pull request Oct 17, 2025
Synchronize source files from linuxdeepin/qt5platform-plugins.

Source-pull-request: linuxdeepin/qt5platform-plugins#307
@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

@18202781743
Copy link
Contributor Author

/topic dtk-cpv20

@deepin-ci-robot
Copy link
Contributor

Add topic: dtk-cpv20 successed.

平台插件中判断_NET_KDE_COMPOSITE_TOGGLING是否为0,如果是0就不做处理

Log: 修复Qt 的 XCB 后端 GetProperty 有大量的 "BadAtom" 错误
Bug: https://pms.uniontech.com/bug-view-237955.html
Influence: X11下应用日志 xcb"badatom"报错
Change-Id: I9620627f5b41c2a609d4df490eacdce802417a7f
deepin-ci-robot added a commit to linuxdeepin/qt6platform-plugins that referenced this pull request Nov 6, 2025
Synchronize source files from linuxdeepin/qt5platform-plugins.

Source-pull-request: linuxdeepin/qt5platform-plugins#307
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

我来对这段代码进行审查:

  1. 语法逻辑:
  • 代码语法正确,没有明显的语法错误
  • 逻辑流程清晰,新增的检查放在了合适的位置
  1. 代码质量:
  • 优点:
    • 添加了atom的有效性检查,提高了代码健壮性
    • 使用qWarning()输出警告信息,便于调试和问题追踪
  • 可改进点:
    • 警告信息可以更具体,比如说明在什么情况下atom会是0
    • 可以考虑使用更具体的错误日志级别
  1. 代码性能:
  • 新增的检查是一个简单的条件判断,对性能影响很小
  • 这个检查是必要的,可以避免后续可能的无效操作
  1. 代码安全:
  • 增加了对atom值的验证,这是一个好的安全实践
  • 避免了在atom无效时继续执行可能导致的问题

改进建议:

  1. 可以优化警告信息,使其更具描述性:
qWarning() << "Failed to get _NET_KDE_COMPOSITE_TOGGLING atom, atom value is 0. This might indicate X11 server communication issue.";
  1. 可以考虑使用QDebug的命名空间:
using namespace QtDebug;
qWarning() << "Failed to get _NET_KDE_COMPOSITE_TOGGLING atom...";
  1. 可以考虑添加更多上下文信息:
if (atom == 0) {
    qWarning() << "Failed to get _NET_KDE_COMPOSITE_TOGGLING atom on display:" 
               << DisplayString(xcb_connection);
    return;
}
  1. 如果这是一个关键错误,可以考虑使用Q_ASSERT_X进行断言:
Q_ASSERT_X(atom != 0, "DXcbWMSupport::updateHasComposite", 
           "_NET_KDE_COMPOSITE_TOGGLING atom is not available");

总的来说,这个改动是一个很好的改进,增加了代码的健壮性。建议的改进主要是为了提供更好的错误诊断信息,帮助开发者更快地定位问题。

@18202781743 18202781743 merged commit 18b70c7 into linuxdeepin:master Nov 6, 2025
21 of 22 checks passed
@github-project-automation github-project-automation bot moved this to Done in dtk-cpv20 Nov 6, 2025
18202781743 pushed a commit to linuxdeepin/qt6platform-plugins that referenced this pull request Nov 6, 2025
Synchronize source files from linuxdeepin/qt5platform-plugins.

Source-pull-request: linuxdeepin/qt5platform-plugins#307
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants