From 7079db6476ca46a0a400b663aef2bff6ccbdc0f6 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Fri, 18 Sep 2026 19:35:00 +0200 Subject: [PATCH] [embedding] Fix ChromeTooltipListener. --- embedding/browser/nsDocShellTreeOwner.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/embedding/browser/nsDocShellTreeOwner.cpp b/embedding/browser/nsDocShellTreeOwner.cpp index 70b7e9c075..da1dfe49da 100644 --- a/embedding/browser/nsDocShellTreeOwner.cpp +++ b/embedding/browser/nsDocShellTreeOwner.cpp @@ -1082,6 +1082,9 @@ ChromeTooltipListener::ChromeTooltipListener(nsWebBrowser* aInBrowser, ChromeTooltipListener::~ChromeTooltipListener() { + if (mTooltipTimer) { + mTooltipTimer->Cancel(); + } } // Hook up things to the chrome like context menus and tooltips, if the chrome @@ -1329,7 +1332,7 @@ void ChromeTooltipListener::sTooltipCallback(nsITimer* aTimer, void* aChromeTooltipListener) { - auto self = static_cast(aChromeTooltipListener); + RefPtr self = static_cast(aChromeTooltipListener); if (self && self->mPossibleTooltipNode) { // The actual coordinates we want to put the tooltip at are relative to the // toplevel docshell of our mWebBrowser. We know what the screen @@ -1374,7 +1377,7 @@ ChromeTooltipListener::sTooltipCallback(nsITimer* aTimer, self->mPossibleTooltipNode, getter_Copies(tooltipText), getter_Copies(directionText), &textFound); - if (textFound) { + if (self->mPossibleTooltipNode && textFound) { nsString tipText(tooltipText); nsString dirText(directionText); LayoutDeviceIntPoint screenDot = widget->WidgetToScreenOffset();