Skip to content

Commit 1d4969e

Browse files
mhduiyBLumia
authored andcommitted
fix: add null check for m_defSinkInter in sound applet
Added null pointer check for m_defSinkInter before accessing its properties in removeDisabledDevice method. This prevents potential segmentation faults when the default sink interface is not properly initialized or has been destroyed. Influence: 1. Test removing disabled audio devices when m_defSinkInter is null 2. Verify sound applet stability during device hot-plug operations 3. Test audio device switching scenarios with multiple sound cards 4. Verify no crashes occur when disabling audio devices fix: 在声音小程序中添加对 m_defSinkInter 的空指针检查 在 removeDisabledDevice 方法中访问 m_defSinkInter 属性前添加了空指针检 查。这可以防止当默认接收器接口未正确初始化或已被销毁时可能发生的段错误。 Influence: 1. 测试当 m_defSinkInter 为空时移除禁用的音频设备 2. 验证在设备热插拔操作期间声音小程序的稳定性 3. 测试多声卡场景下的音频设备切换 4. 验证禁用音频设备时不会发生崩溃 PMS: BUG-347845
1 parent be31f54 commit 1d4969e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

plugins/dde-dock/sound/soundapplet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ void SoundApplet::enableDevice(bool flag)
319319
void SoundApplet::removeDisabledDevice(QString portName, unsigned int cardId)
320320
{
321321
removePort(SoundCardPort::compositeKey(cardId, portName));
322-
if (m_defSinkInter->activePort().name == portName && m_defSinkInter->card() == cardId) {
322+
if (m_defSinkInter && m_defSinkInter->activePort().name == portName && m_defSinkInter->card() == cardId) {
323323
enableDevice(false);
324324
}
325325
}

0 commit comments

Comments
 (0)