fix: improve Windows settings backend and thread safety - #576
Conversation
fix: 改进 Windows 设置后端和线程安全性 - Use QSettings::IniFormat on Windows instead of NativeFormat (registry), ensuring settings are stored as INI files consistent with Linux behavior - Move loadValue() call before backend is moved to worker thread to prevent cross-thread race conditions when keys() and getOption() access the backend - Use BlockingQueuedConnection for doSync() to ensure sync operations execute in the backend's worker thread while the caller waits for completion - Update copyright years to 2026 - 在 Windows 上使用 QSettings::IniFormat 替代 NativeFormat(注册表格式), 确保设置以 INI 文件形式存储,与 Linux 行为保持一致 - 将 loadValue() 调用移到 backend 移动到工作线程之前,防止 keys() 和 getOption() 跨线程访问 backend 导致竞态条件 - 使用 BlockingQueuedConnection 执行 doSync(),确保同步操作在 backend 的 工作线程中执行,同时调用者等待完成 - 更新版权年份至 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kt286 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 |
|
Hi @kt286. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts the Windows settings backend to use INI files instead of the registry and fixes threading issues by loading settings before moving the backend to a worker thread and ensuring sync runs on the backend thread, plus copyright year updates. Sequence diagram for DSettings::setBackend threading and load ordersequenceDiagram
participant DSettings
participant DSettingsBackend
participant QThread as backendWriteThread
DSettings->>DSettingsBackend: setBackend(backend)
DSettings->>DSettingsBackend: loadValue()
DSettings->>QThread: new QThread
DSettings->>DSettingsBackend: moveToThread(backendWriteThread)
DSettings->>QThread: start()
QThread->>DSettingsBackend: [runs backend in worker thread]
Sequence diagram for DSettings::sync using BlockingQueuedConnectionsequenceDiagram
participant Caller
participant DSettings
participant DSettingsBackend
participant QThread as backendWriteThread
Caller->>DSettings: sync()
DSettings->>DSettings: [backend is null?]
alt backend not null
DSettings->>DSettingsBackend: invokeMethod(doSync, BlockingQueuedConnection)
QThread->>DSettingsBackend: doSync()
DSettingsBackend-->>DSettings: [doSync finished]
DSettings-->>Caller: sync() return
else backend is null
DSettings-->>Caller: sync() return
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
/forcemerge |
|
This pr force merged! (status: blocked) |
fix: 改进 Windows 设置后端和线程安全性
Use QSettings::IniFormat on Windows instead of NativeFormat (registry), ensuring settings are stored as INI files consistent with Linux behavior
Move loadValue() call before backend is moved to worker thread to prevent cross-thread race conditions when keys() and getOption() access the backend
Use BlockingQueuedConnection for doSync() to ensure sync operations execute in the backend's worker thread while the caller waits for completion
Update copyright years to 2026
在 Windows 上使用 QSettings::IniFormat 替代 NativeFormat(注册表格式), 确保设置以 INI 文件形式存储,与 Linux 行为保持一致
将 loadValue() 调用移到 backend 移动到工作线程之前,防止 keys() 和 getOption() 跨线程访问 backend 导致竞态条件
使用 BlockingQueuedConnection 执行 doSync(),确保同步操作在 backend 的 工作线程中执行,同时调用者等待完成
更新版权年份至 2026
Summary by Sourcery
Improve Windows settings backend behavior and thread safety for configuration loading and syncing.
Bug Fixes:
Enhancements:
Documentation: