From 58b4798b797206084a2d02e75de88debad80c79f Mon Sep 17 00:00:00 2001 From: John Preston <johnprestonmail@gmail.com> Date: Wed, 28 Jun 2017 19:02:42 +0300 Subject: [PATCH] Fix tooltip hiding when window is hidden by Cmd+H. For some reason deleteLater() called for the tooltip from the main window deactivation signal is really handled only on app quit :/ So now we use InvokeQueued(p, [p] { delete p; }); there instead. Fixes #3461 --- Telegram/SourceFiles/ui/widgets/tooltip.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/ui/widgets/tooltip.cpp b/Telegram/SourceFiles/ui/widgets/tooltip.cpp index cb0549f5f..b5dc231c4 100644 --- a/Telegram/SourceFiles/ui/widgets/tooltip.cpp +++ b/Telegram/SourceFiles/ui/widgets/tooltip.cpp @@ -69,7 +69,7 @@ void Tooltip::performShow() { void Tooltip::onWndActiveChanged() { if (!App::wnd() || !App::wnd()->windowHandle() || !App::wnd()->windowHandle()->isActive()) { - Tooltip::Hide(); + Hide(); } } @@ -88,12 +88,13 @@ bool Tooltip::eventFilter(QObject *o, QEvent *e) { Tooltip::~Tooltip() { if (TooltipInstance == this) { - TooltipInstance = 0; + TooltipInstance = nullptr; } } void Tooltip::popup(const QPoint &m, const QString &text, const style::Tooltip *st) { if (!_isEventFilter) { + _isEventFilter = true; QCoreApplication::instance()->installEventFilter(this); } @@ -196,7 +197,7 @@ void Tooltip::Hide() { instance->_showTimer.cancel(); instance->_hideByLeaveTimer.cancel(); instance->hide(); - instance->deleteLater(); + InvokeQueued(instance, [instance] { instance->deleteLater(); }); } }