Skip to content

fix: replace QScopedPointer with raw pointer for DSGConfigManager#550

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
18202781743:master
Mar 25, 2026
Merged

fix: replace QScopedPointer with raw pointer for DSGConfigManager#550
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743

Copy link
Copy Markdown
Contributor
  1. Changed DBusBackend::config from QScopedPointer 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*
  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

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
@18202781743 18202781743 requested review from BLumia and mhduiy March 25, 2026 08:46
@deepin-ci-robot

Copy link
Copy Markdown
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.

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

@18202781743

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: blocked)

@deepin-bot deepin-bot Bot merged commit 2d49c07 into linuxdeepin:master Mar 25, 2026
17 of 20 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.

4 participants