fix :多次向右旋转屏幕导致任务栏消失

多次旋转屏幕后,声音信息发生改变,触发了对野指针的判断

Log: 修复多次向右旋转屏幕导致任务栏消失问题
Bug: https://pms.uniontech.com/zentao/bug-view-51625.html
Change-Id: Ie2c7c43255412b86e63a16bc487d2edb2d09d153
This commit is contained in:
Xie Chuan 2020-10-29 08:49:00 +08:00 committed by Fanpengcheng
parent 35df09ee53
commit 52b13f8b19
2 changed files with 2 additions and 2 deletions

View File

@ -263,7 +263,7 @@ void SoundApplet::defaultSinkChanged()
QString portId = m_defSinkInter->activePort().name;
uint cardId = m_defSinkInter->card();
//最后一个设备会被移除,但是当在控制中心选中此设备后需要添加,并勾选
if (m_lastPort && m_lastPort->cardId() == cardId && m_lastPort->id() == portId) {
if (!m_lastPort.isNull() && m_lastPort->cardId() == cardId && m_lastPort->id() == portId) {
startAddPort(m_lastPort);
}
activePort(portId,cardId);

View File

@ -153,7 +153,7 @@ private:
QStandardItemModel *m_model;
QList<Port *> m_ports;
QString m_deviceInfo;
Port *m_lastPort;//最后一个因为只有一个设备而被直接移除的设备
QPointer<Port> m_lastPort;//最后一个因为只有一个设备而被直接移除的设备
};
#endif // SOUNDAPPLET_H