fix: replace QScopedPointer with raw pointer for DSGConfigManager#550
Merged
Conversation
1. Changed DBusBackend::config from QScopedPointer<DSGConfigManager> to raw pointer DSGConfigManager* 2. Initialize config to nullptr in constructor initializer list 3. Replace config.reset(new DSGConfigManager(...)) with direct new operator 4. Replace config.reset() with config->deleteLater() and config = nullptr in error handling 5. Replace config.data() with config in QObject::connect call 6. This eliminates redundant ownership management since DSGConfigManager is already a QObject with its own lifetime management Log: Fixed potential double deletion issue with DSGConfigManager object Influence: 1. Test DConfig functionality with DBus backend to ensure no memory leaks 2. Verify that valueChanged signals are still properly connected and emitted 3. Test error scenarios where DSGConfigManager creation fails 4. Verify object cleanup when DConfig is destroyed 5. Test with multiple DConfig instances to ensure no interference fix: 将 DSGConfigManager 的 QScopedPointer 替换为原始指针 1. 将 DBusBackend::config 从 QScopedPointer<DSGConfigManager> 改为原始指 针 DSGConfigManager* 2. 在构造函数初始化列表中初始化 config 为 nullptr 3. 将 config.reset(new DSGConfigManager(...)) 替换为直接使用 new 操作符 4. 在错误处理中将 config.reset() 替换为 config->deleteLater() 和 config = nullptr 5. 在 QObject::connect 调用中将 config.data() 替换为 config 6. 消除了重复的所有权管理,因为 DSGConfigManager 已经是具有自身生命周期 管理的 QObject Log: 修复了 DSGConfigManager 对象可能被重复删除的问题 Influence: 1. 测试使用 DBus 后端的 DConfig 功能,确保没有内存泄漏 2. 验证 valueChanged 信号是否仍然正确连接和发射 3. 测试 DSGConfigManager 创建失败的场景 4. 验证 DConfig 销毁时的对象清理 5. 测试多个 DConfig 实例以确保没有相互干扰 PMS: BUG-335881
mhduiy
approved these changes
Mar 25, 2026
BLumia
approved these changes
Mar 25, 2026
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, BLumia, mhduiy 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 |
Contributor
Author
|
/forcemerge |
Contributor
|
This pr force merged! (status: blocked) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
raw pointer DSGConfigManager*
operator
nullptr in error handling
is already a QObject with its own lifetime management
Log: Fixed potential double deletion issue with DSGConfigManager object
Influence:
leaks
emitted
fix: 将 DSGConfigManager 的 QScopedPointer 替换为原始指针
针 DSGConfigManager*
= nullptr
管理的 QObject
Log: 修复了 DSGConfigManager 对象可能被重复删除的问题
Influence:
PMS: BUG-335881