From a8f74a011f31cd4f5a816d267a02b92539ecd73d Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 31 Jul 2024 16:45:03 +0200 Subject: [PATCH] Debugger: Fix potential crash When triggering context menu on locals, receiving an update for locals (e.g. still running fetch of locals finishes, expanding children,..) and triggering an action referring to a former now no more existing item. Close the menu on updates to avoid this scenario. Change-Id: I273bb85d497dfbaa257f267a866ea014a7e3b209 Reviewed-by: hjk --- src/plugins/debugger/watchhandler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index c5600cd9ee8..888ca18abcf 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -1827,6 +1827,7 @@ bool WatchModel::contextMenuEvent(const ItemViewEvent &ev) menu->addAction(s.settingsDialog.action()); // useDebuggingHelpers/useDynamicType have no auto-apply, but need to be persisted on triggered + connect(this, &WatchModel::dataChanged, menu, &QMenu::close); connect(debugHelperAction, &QAction::triggered, &s.useDebuggingHelpers, &BoolAspect::writeSettings, Qt::UniqueConnection); connect(dynamicTypeAction, &QAction::triggered,