From 1c24751b8c6099c88d4c4689c484646b7e045f87 Mon Sep 17 00:00:00 2001 From: ssk-wh Date: Thu, 29 Dec 2022 17:13:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8F=92=E5=85=A5U?= =?UTF-8?q?=E7=9B=98=E5=90=8E=E5=AF=BC=E8=87=B4=E7=9A=84=E5=B4=A9=E6=BA=83?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 指针异常 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 bf8298762..311cfaedf 100644 --- a/plugins/tray/system-trays/systemtrayscontroller.cpp +++ b/plugins/tray/system-trays/systemtrayscontroller.cpp @@ -32,7 +32,7 @@ void SystemTraysController::itemAdded(PluginsItemInterface * const itemInter, co else { emit pluginItemRemoved(itemKey, item); } - }, Qt::QueuedConnection); + }); mPluginsMap[itemInter][itemKey] = item; @@ -69,7 +69,10 @@ void SystemTraysController::itemRemoved(PluginsItemInterface * const itemInter, item->centralWidget()->setParent(nullptr); // 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)