Repository navigation
fix: change static firstLoadFlag to instance member - #866
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR fixes missed first-load notifications in multi-instance scenarios by replacing the shared static firstLoadFlag with a per-instance m_FirstLoadFlag, initialized in each LoadInfoThread constructor and consumed when the instance first finishes loading its file pool. Sequence diagram for per-instance first-load notificationsequenceDiagram
participant InstanceA as LoadInfoThreadA
participant PoolA as GetInfoPoolA
participant InstanceB as LoadInfoThreadB
participant PoolB as GetInfoPoolB
InstanceA->>InstanceA: LoadInfoThread()
InstanceA->>PoolA: finishedAll
PoolA-->>InstanceA: slotFinishedReadFilePool()
InstanceA-->>InstanceA: emit finishedReadFilePool()
InstanceB->>InstanceB: LoadInfoThread()
InstanceB->>PoolB: finishedAll
PoolB-->>InstanceB: slotFinishedReadFilePool()
InstanceB-->>InstanceB: emit finishedReadFilePool()
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 当前实现已正确修复,无需额外修改。
// LoadInfoThread.h 中已声明:
// bool m_FirstLoadFlag; //<! 标识是否为首次加载
// LoadInfoThread.cpp 构造函数初始化列表中已初始化:
// , m_FirstLoadFlag(true)
// slotFinishedReadFilePool 中已正确使用实例成员判断并重置。本报告由 AI 代码审查工具自动生成 |
1. Root cause: file-level static bool firstLoadFlag was shared across all LoadInfoThread instances, first instance set it false, new instances never emit finishedReadFilePool signal again 2. Fix: replace static firstLoadFlag with instance member m_FirstLoadFlag initialized to true in constructor init list, each instance gets independent flag for first-load detection 3. Impact: only LoadInfoThread affected, single-instance usage unchanged, multi-instance scenarios now correctly emit signal on first load Influence: 1. Test single LoadInfoThread instance emits finishedReadFilePool on first load 2. Test multiple sequential LoadInfoThread instances each emit signal 3. Verify no regression on device info loading workflow fix: 将静态 firstLoadFlag 改为实例成员 1. 根因:文件级 static bool firstLoadFlag 跨所有 LoadInfoThread 实例 共享,首个实例将其置为 false 后,后续新建实例永远不再 emit finishedReadFilePool 信号 2. 方案:将 static firstLoadFlag 替换为实例成员 m_FirstLoadFlag,在 构造函数初始化列表中初始化为 true,每个实例拥有独立首次加载标志 3. 影响:仅影响 LoadInfoThread 实例,单实例场景行为不变,多实例场景 下首次加载信号正常触发 Influence: 1. 测试单个 LoadInfoThread 实例首次加载触发 finishedReadFilePool 信号 2. 测试多个连续 LoadInfoThread 实例各自触发信号 3. 验证设备信息加载流程无回归
The license-check CI (SPDX Header Validation) requires touched sources to carry a copyright year ending with the current year. Extend the SPDX-FileCopyrightText header of LoadInfoThread.cpp from 2022 to 2022-2026 so the SPDX summary reports 0 failures.
19f971b to
f2cb05a
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
fix: change static firstLoadFlag to instance member
all LoadInfoThread instances, first instance set it false, new
instances never emit finishedReadFilePool signal again
initialized to true in constructor init list, each instance gets
independent flag for first-load detection
multi-instance scenarios now correctly emit signal on first load
Influence:
first load
fix: 将静态 firstLoadFlag 改为实例成员
共享,首个实例将其置为 false 后,后续新建实例永远不再 emit
finishedReadFilePool 信号
构造函数初始化列表中初始化为 true,每个实例拥有独立首次加载标志
下首次加载信号正常触发
Influence:
Summary by Sourcery
Bug Fixes: