DolphinQt: Fix crash from stale timer event in ToolTipWidget

LLM generated explaination for the LLM generated commit:

A queued QTimerEvent can be dispatched after the timer was already killed (Qt recycles timer ids), e.g. when a slider is dragged and enter/leave events fire in rapid succession. In that case m_timer_id is empty and dereferencing it in timerEvent() asserts on 'this->_M_is_engaged()' in debug builds, while in release builds it passes a garbage timer id to killTimer().

Only process the event if it matches the timer we are tracking, which also prevents showing a balloon for a stale event.
This commit is contained in:
debug687
2026-10-19 21:29:55 +00:00
committed by OatmealDome
parent ba77539b53
commit 5eaaba5a43

View File

@@ -6,6 +6,7 @@
#include <optional>
#include <QString>
#include <QTimerEvent>
#include "DolphinQt/Config/ToolTipControls/BalloonTip.h"
@@ -57,12 +58,14 @@ private:
void timerEvent(QTimerEvent* const event) override
{
this->killTimer(*m_timer_id);
m_timer_id.reset();
BalloonTip::ShowBalloon(m_title, m_description,
this->parentWidget()->mapToGlobal(GetToolTipPosition()), this);
if (m_timer_id == event->timerId())
{
this->killTimer(*m_timer_id);
m_timer_id.reset();
BalloonTip::ShowBalloon(m_title, m_description,
this->parentWidget()->mapToGlobal(GetToolTipPosition()), this);
}
Derived::timerEvent(event);
}