From 3c1e92d39c89f1b425361ef357881d4fb2c40505 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Fri, 23 Oct 2026 04:26:44 +0800 Subject: [PATCH 1/2] fix: change static firstLoadFlag to instance member MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. 验证设备信息加载流程无回归 --- deepin-devicemanager/src/GenerateDevice/LoadInfoThread.cpp | 7 +++---- deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.cpp b/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.cpp index 4be08d630..768ada101 100644 --- a/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.cpp +++ b/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.cpp @@ -20,7 +20,6 @@ using namespace DDLog; DWIDGET_USE_NAMESPACE -static bool firstLoadFlag = true; LoadInfoThread::LoadInfoThread() : mp_ReadFilePool() @@ -28,6 +27,7 @@ LoadInfoThread::LoadInfoThread() , m_Running(false) , m_FinishedReadFilePool(false) , m_Start(true) + , m_FirstLoadFlag(true) { qCDebug(appLog) << "LoadInfoThread constructor"; connect(&mp_ReadFilePool, &GetInfoPool::finishedAll, this, &LoadInfoThread::slotFinishedReadFilePool); @@ -134,9 +134,9 @@ void LoadInfoThread::slotFinishedReadFilePool(const QString &) qCDebug(appLog) << "LoadInfoThread::slotFinishedReadFilePool"; m_FinishedReadFilePool = true; // 首次加载刷新 - if (firstLoadFlag) { + if (m_FirstLoadFlag) { qCDebug(appLog) << "LoadInfoThread::slotFinishedReadFilePool first load, emit finishedReadFilePool"; - firstLoadFlag = false; + m_FirstLoadFlag = false; emit finishedReadFilePool(); } } @@ -147,4 +147,3 @@ void LoadInfoThread::setFramework(const QString &arch) // 设置架构 mp_ReadFilePool.setFramework(arch); } - diff --git a/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h b/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h index 440f285b0..2ff14fdaf 100644 --- a/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h +++ b/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.h @@ -44,6 +44,7 @@ private slots: bool m_Running; // Date: Mon, 26 Oct 2026 18:11:38 +0800 Subject: [PATCH 2/2] chore: update SPDX copyright year to 2022-2026 (CI SPDX check) 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. --- deepin-devicemanager/src/GenerateDevice/LoadInfoThread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.cpp b/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.cpp index 768ada101..9efd64168 100644 --- a/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.cpp +++ b/deepin-devicemanager/src/GenerateDevice/LoadInfoThread.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022-2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later