fix: 修复插入U盘后导致的崩溃问题

指针异常

Log: 修复插入U盘后导致的崩溃问题
Influence: 反复插拔u盘任务栏崩溃
Bug: https://pms.uniontech.com/bug-view-180075.html
Bug: https://pms.uniontech.com/bug-view-180039.html
Change-Id: I0a6ec7c0c29e782ab5f9a7beaad1288a49072376
This commit is contained in:
ssk-wh 2022-12-29 17:13:53 +08:00 committed by deepin-bot[bot]
parent 87308cb76b
commit af6c9d6185

View File

@ -32,7 +32,7 @@ void SystemTraysController::itemAdded(PluginsItemInterface * const itemInter, co
else { else {
emit pluginItemRemoved(itemKey, item); emit pluginItemRemoved(itemKey, item);
} }
}, Qt::QueuedConnection); });
mPluginsMap[itemInter][itemKey] = item; mPluginsMap[itemInter][itemKey] = item;
@ -69,7 +69,10 @@ void SystemTraysController::itemRemoved(PluginsItemInterface * const itemInter,
item->centralWidget()->setParent(nullptr); item->centralWidget()->setParent(nullptr);
// just delete our wrapper object(PluginsItem) // just delete our wrapper object(PluginsItem)
item->deleteLater(); // 直接删除item被用到的地方太多且很多地方没判断是否为空不应该用deleteLater
// item->deleteLater();
delete item;
item = nullptr;
} }
void SystemTraysController::requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) void SystemTraysController::requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide)