Skip to content

Commit a671a09

Browse files
committed
fix: use QPointer for default sink DBus interface
1. Changed m_defaultSinkInter from raw DBusSink pointer to QPointer<DBusSink> 2. This prevents potential dangling pointer issues when the DBus object is destroyed 3. QPointer automatically becomes null when the referenced QObject is deleted 4. Improves memory safety and prevents crashes in the sound controller Influence: 1. Test sound plugin functionality after system sound service restarts 2. Verify no crashes occur when default audio sink changes 3. Test volume control and mute functionality stability 4. Verify plugin correctly handles DBus service disappearance and reappearance fix: 使用 QPointer 管理默认音频接收器的 DBus 接口 1. 将 m_defaultSinkInter 从原始 DBusSink 指针改为 QPointer<DBusSink> 2. 防止当 DBus 对象被销毁时出现悬空指针问题 3. QPointer 在被引用的 QObject 删除时会自动变为 null 4. 提高内存安全性,防止声音控制器崩溃 Influence: 1. 测试系统声音服务重启后声音插件的功能 2. 验证默认音频接收器更改时不会发生崩溃 3. 测试音量控制和静音功能的稳定性 4. 验证插件正确处理 DBus 服务消失和重新出现的情况 PMS: BUG-347199
1 parent adb65c2 commit a671a09

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

plugins/dde-dock/sound/soundcontroller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class SoundController final : public QObject, public Dtk::Core::DSingleton<Sound
4747

4848
private:
4949
DBusAudio *m_audioInter;
50-
DBusSink *m_defaultSinkInter;
50+
QPointer<DBusSink> m_defaultSinkInter;
5151
QSharedPointer<DConfig> m_dconfig;
5252
};
5353

0 commit comments

Comments
 (0)