Debugger: Purge dead tooltips before accessing them

Fixes: QTCREATORBUG-31323
Change-Id: I58a4235f40fa7976dd0f18edeb4c3b0954283af9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2024-07-29 07:46:11 +02:00
parent 2decdd7955
commit ffae39f425

View File

@@ -832,8 +832,10 @@ void DebuggerToolTipManager::closeAllToolTips()
void DebuggerToolTipManagerPrivate::closeAllToolTips()
{
for (DebuggerToolTipWidget *tooltip : std::as_const(m_tooltips))
tooltip->destroy();
for (DebuggerToolTipWidget *tooltip : std::as_const(m_tooltips)) {
if (tooltip)
tooltip->destroy();
}
m_tooltips.clear();
}
@@ -1008,6 +1010,7 @@ DebuggerToolTipContexts DebuggerToolTipManager::pendingTooltips() const
{
StackFrame frame = d->m_engine->stackHandler()->currentFrame();
DebuggerToolTipContexts rc;
d->purgeClosedToolTips();
for (DebuggerToolTipWidget *tooltip : std::as_const(d->m_tooltips)) {
const DebuggerToolTipContext &context = tooltip->context;
if (context.iname.startsWith("tooltip") && context.matchesFrame(frame))