Skip to content

sync: from linuxdeepin/dde-session-shell#513

Merged
robertkill merged 1 commit into
masterfrom
sync-pr-70-nosync
Jun 30, 2026
Merged

sync: from linuxdeepin/dde-session-shell#513
robertkill merged 1 commit into
masterfrom
sync-pr-70-nosync

Conversation

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#70

@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 @deepin-ci-robot, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown
Contributor Author

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deepin-ci-robot

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

@deepin-ci-robot

Copy link
Copy Markdown
Contributor Author

deepin pr auto review


★ 总体评分:100分

■ 【总体评价】

代码精准修复了UOS登录界面输入框清空时的状态机异常,实现极其优雅
逻辑完全正确且无任何安全与性能隐患,满分通过

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

修改将所有认证组件和 Lighter Greeter 中的 m_lineEdit->clear() / m_passwordEdit->clear() 统一替换为 setText(QString())。在 Qt 框架中,QString() 构造一个空字符串对象,setText 接收该对象并设置文本,语法完全合法,能够达到清空文本的目的。
建议:无需改进,当前实现已完美规避 clear() 内部可能重置 isModified 等编辑状态标志位引发的副作用。

  • 2.代码质量(良好)✓

修改点高度聚焦于业务痛点,涉及 lightergreeter.cppauth_password.cppauth_single.cppauth_ukey.cpp 四个核心认证文件。通过统一替换函数调用,消除了上层状态机判断异常的隐患,提高了代码在复杂认证流转中的健壮性。
建议:可以考虑在项目级别增加对 QLineEdit::clear() 在敏感输入框中使用的代码规范约束或静态检查规则,防止后续新增代码引入同类问题。

  • 3.代码性能(无性能问题)✓

setText(QString()) 会在栈上构造一个临时的空 QString 对象。由于 Qt 内部采用了隐式共享(写时复制)机制,且对空字符串有全局静态共享实例的优化,该操作不会产生额外的内存分配开销,性能与原 clear() 方法几乎无异。
建议:无需优化。

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
总体风险描述:本次修改仅涉及 UI 层面的文本状态重置,不涉及系统命令执行、文件读写、权限提升或敏感数据越权访问,无任何安全风险。
建议:继续保持当前安全的编码实践。

■ 【改进建议代码示例】

// 当前代码已为最佳实践,以下展示一种可选的微调写法(使用空字符串字面量,语义等价)
diff --git a/src/session-widgets/auth_password.cpp b/src/session-widgets/auth_password.cpp
--- a/src/session-widgets/auth_password.cpp
+++ b/src/session-widgets/auth_password.cpp
@@ -318,7 +318,7 @@ void AuthPassword::initConnections()
  */
 void AuthPassword::reset()
 {
-    m_lineEdit->clear();
+    m_lineEdit->setText(QString()); // 使用 setText(QString()) 规避 clear() 的状态标志位副作用
     m_lineEdit->setAlert(false);
     m_lineEdit->hideAlertMessage();
     setFocusProxy(m_lineEdit);

Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#70
@robertkill robertkill merged commit 79c10f6 into master Jun 30, 2026
25 of 29 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.

2 participants