diff options
author | David Schulz <david.schulz@qt.io> | 2024-04-25 10:01:29 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2024-04-30 10:56:11 +0000 |
commit | 7a47cf0a11baa7e0b4416be181d09b62596987d8 (patch) | |
tree | c24e6f2cff6c025a3ab66c1b58d3dc75e6585852 | |
parent | 8b682ac7f55d3762875631df21ec28ff9d0a7669 (diff) |
Utils: fix crash on hiding a tooltip
Closing the tip label indirectly calls ToolTip::hideTipImmediately via
its eventFilter that closes the tool tip on any FocusIn/Out event on the
application. Since m_tip is reset in hideTipImmediately the outer call
crashes when this nullptr gets dereferenced. Avoid this crash by
resetting m_tip before closing the tip label.
Fixes: QTCREATORBUG-30738
Change-Id: Id3e690141be196db8ac6c4dab3d97627c0657140
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r-- | src/libs/utils/tooltip/tooltip.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libs/utils/tooltip/tooltip.cpp b/src/libs/utils/tooltip/tooltip.cpp index 93f4c1d2ff..da11540c08 100644 --- a/src/libs/utils/tooltip/tooltip.cpp +++ b/src/libs/utils/tooltip/tooltip.cpp @@ -288,9 +288,11 @@ void ToolTip::hideTipWithDelay() void ToolTip::hideTipImmediately() { if (m_tip) { - m_tip->close(); - m_tip->deleteLater(); - m_tip = nullptr; + TipLabel *tip = m_tip.data(); + m_tip.clear(); + + tip->close(); + tip->deleteLater(); } m_showTimer.stop(); m_hideDelayTimer.stop(); |