Skip to content

fix: fingerprint enrollment dialog becomes unresponsive after losing …#3300

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
fly602:master
Jun 17, 2026
Merged

fix: fingerprint enrollment dialog becomes unresponsive after losing …#3300
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
fly602:master

Conversation

@fly602

@fly602 fly602 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

…focus

Root cause:
It's a timing/race condition. After stopEnroll(), Claim(false) was called immediately, causing DA to release the fingerprint device. However, the EnrollStatus state update from DA arrives after the device is released. Since the device is already released, DA discards the pending state change and does not emit the signal. As a result, the control center never receives the state update, leaving the UI stuck in Processing state with no error message or retry option.

Changes:

  1. Move Claim(false) from stopFingerEnroll() to signal handlers (onFingerEnrollFailed, onFingerEnrollCompleted, onFingerEnrollDisconnected), ensuring it is called only after DA's state change signal is received
  2. Add releaseFingerClaim() to CharaMangerWorker for device claim release after enrollment ends
  3. Add Suspended state to represent enrollment interrupted by focus loss, showing grayed icon and retry option
  4. Reset addStage to StartState when dialog is closed

fix: 指纹录入界面失去焦点后不可操作

问题根因:
这是一个时序/竞态条件问题。stopEnroll() 之后立即调用了 Claim(false),
导致 DA 立即释放指纹设备。但 DA 的 EnrollStatus 状态更新比设备释放
晚到达,由于设备已释放,DA 丢弃了该状态变更,不会发出状态变更信号。
因此控制中心收不到 DA 的状态更新,界面停留在 Processing 状态,没有
错误信息也没有重试选项。

修改内容:

  1. 将 Claim(false) 从 stopFingerEnroll() 移至信号回调 (onFingerEnrollFailed、onFingerEnrollCompleted、 onFingerEnrollDisconnected) 中,确保在收到 DA 状态变更信号后 才释放设备声明
  2. 新增 releaseFingerClaim() 方法,在录入结束后释放设备声明
  3. 新增 Suspended 状态表示焦点中断的录入,显示置灰图标和重试选项
  4. 关闭对话框时重置 addStage 为 StartState

PMS: BUG-364881

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

Please try again later or upgrade to continue using Sourcery

@fly602 fly602 force-pushed the master branch 2 times, most recently from 08f4c85 to a126d0c Compare June 17, 2026 05:13
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: caixr23, fly602

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

deepin-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 6.1.94
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #3301

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:95分

■ 【总体评价】

代码正确修复了指纹设备Claim权限未释放的资源泄漏问题,但存在版权年份误改的低级瑕疵
逻辑正确但因SPDX年份错误扣5分

■ 【详细分析】

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

将 CharaMangerWorker::stopFingerEnroll 中的 Claim 释放逻辑剥离为独立的 releaseFingerClaim 函数,并在 FingerprintAuthController 的三个结束回调中正确补充调用,彻底解决了设备长期占用的根因,逻辑严密且无语法错误

  • 2.代码质量 一般 ✕

在 charamangerworker.cpp 和 charamangerworker.h 文件头部,将 SPDX-FileCopyrightText 的年份从 2025 错误地修改为 2026,属于明显的笔误
潜在问题:版权年份错误不符合开源文件头规范,可能引发合规审计时的误判
建议:将 2026 还原为 2025,或根据实际发布年份进行准确修正

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

releaseFingerClaim 内部使用的 waitForFinished 虽为同步阻塞调用,但原代码中同样采用此方式,本次修改仅进行了物理位置的平移,未引入额外的性能损耗或调用链路延长

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

存在 0 个安全漏洞
漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次修改有效收敛了指纹设备的权限生命周期,修复了可能导致其他用户或进程无法使用指纹设备的资源耗尽类问题,未引入命令注入、越权等新的安全风险
建议:保持现有的资源释放模式

■ 【改进建议代码示例】

diff --git a/src/plugin-authentication/operation/charamangerworker.cpp b/src/plugin-authentication/operation/charamangerworker.cpp
index c695922ade..73372bd865 100644
--- a/src/plugin-authentication/operation/charamangerworker.cpp
+++ b/src/plugin-authentication/operation/charamangerworker.cpp
@@ -1,4 +1,4 @@
-//SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
+//SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
 //
 //SPDX-License-Identifier: GPL-3.0-or-later
diff --git a/src/plugin-authentication/operation/charamangerworker.h b/src/plugin-authentication/operation/charamangerworker.h
index b071533982..d7a305cf42 100644
--- a/src/plugin-authentication/operation/charamangerworker.h
+++ b/src/plugin-authentication/operation/charamangerworker.h
@@ -1,4 +1,4 @@
-//SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.
+//SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
 //
 //SPDX-License-Identifier: GPL-3.0-or-later

…focus

Root cause:
It's a timing/race condition. After stopEnroll(), Claim(false) was
called immediately, causing DA to release the fingerprint device.
However, the EnrollStatus state update from DA arrives after the device
is released. Since the device is already released, DA discards the
pending state change and does not emit the signal. As a result, the
control center never receives the state update, leaving the UI stuck
in Processing state with no error message or retry option.

Changes:
1. Move Claim(false) from stopFingerEnroll() to signal handlers
   (onFingerEnrollFailed, onFingerEnrollCompleted,
   onFingerEnrollDisconnected), ensuring it is called only after
   DA's state change signal is received
2. Add releaseFingerClaim() to CharaMangerWorker for device claim
   release after enrollment ends
3. Add Suspended state to represent enrollment interrupted by focus
   loss, showing grayed icon and retry option
4. Reset addStage to StartState when dialog is closed

fix: 指纹录入界面失去焦点后不可操作

问题根因:
这是一个时序/竞态条件问题。stopEnroll() 之后立即调用了 Claim(false),
导致 DA 立即释放指纹设备。但 DA 的 EnrollStatus 状态更新比设备释放
晚到达,由于设备已释放,DA 丢弃了该状态变更,不会发出状态变更信号。
因此控制中心收不到 DA 的状态更新,界面停留在 Processing 状态,没有
错误信息也没有重试选项。

修改内容:
1. 将 Claim(false) 从 stopFingerEnroll() 移至信号回调
   (onFingerEnrollFailed、onFingerEnrollCompleted、
   onFingerEnrollDisconnected) 中,确保在收到 DA 状态变更信号后
   才释放设备声明
2. 新增 releaseFingerClaim() 方法,在录入结束后释放设备声明
3. 新增 Suspended 状态表示焦点中断的录入,显示置灰图标和重试选项
4. 关闭对话框时重置 addStage 为 StartState

PMS: BUG-364881
@fly602

fly602 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot deepin-bot Bot merged commit 6068b08 into linuxdeepin:master Jun 17, 2026
16 of 19 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.

3 participants