From 1c24751b8c6099c88d4c4689c484646b7e045f87 Mon Sep 17 00:00:00 2001 From: ssk-wh Date: Thu, 29 Dec 2022 17:13:53 +0800 Subject: [PATCH] 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 --- plugins/tray/system-trays/systemtrayscontroller.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/tray/system-trays/systemtrayscontroller.cpp b/plugins/tray/system-trays/systemtrayscontroller.cpp index bf82987..311cfae 100644 --- a/plugins/tray/system-trays/systemtrayscontroller.cpp +++ b/plugins/tray/system-trays/systemtrayscontroller.cpp @@ -33,5 +33,5 @@ void SystemTraysController::itemAdded(PluginsItemInterface * const itemInter, co emit pluginItemRemoved(itemKey, item); } - }, Qt::QueuedConnection); + }); mPluginsMap[itemInter][itemKey] = item; @@ -70,5 +70,8 @@ void SystemTraysController::itemRemoved(PluginsItemInterface * const itemInter, // just delete our wrapper object(PluginsItem) - item->deleteLater(); + // 直接删除,item被用到的地方太多,且很多地方没判断是否为空,不应该用deleteLater + // item->deleteLater(); + delete item; + item = nullptr; } -- libgit2 1.3.2