From 24239aef35f856c4c06428077e3428cbfdc51775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 29 Oct 2020 15:59:38 +0100 Subject: [PATCH] =?UTF-8?q?QToolTip:=20don=E2=80=99t=20close=20again=20on?= =?UTF-8?q?=20Close=20event?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevent recursion: hideTipImmediately() calls QWidget::close(), which will soon start calling QWindow::close(), which will send another close event. Fix this by calling hideTipImmediately() only for Close events not targeted for the tip label. Task-number: QTBUG-46701 Change-Id: I6fd373ce13aed860b0d4836d5fbf470374ed2543 Reviewed-by: Volker Hilsheimer --- src/widgets/kernel/qtooltip.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp index b397bf9835..387aa476de 100644 --- a/src/widgets/kernel/qtooltip.cpp +++ b/src/widgets/kernel/qtooltip.cpp @@ -342,7 +342,13 @@ bool QTipLabel::eventFilter(QObject *o, QEvent *e) case QEvent::FocusIn: case QEvent::FocusOut: #endif - case QEvent::Close: // For QTBUG-55523 (QQC) specifically: Hide tooltip when windows are closed + case QEvent::Close: + // For QTBUG-55523 (QQC) specifically: Hide tooltip when windows are closed, + // unless the close event is for the this tooltip, in which case we don't + // recursively hide/close again. + if (o != windowHandle() && o != this) + hideTipImmediately(); + break; case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: