jobextra/webkit2gtk/d501d8dce059d7c3307c022e51e1853e348439ac.patch
2023-07-01 14:20:38 +03:00

46 lines
2.2 KiB
Diff

From d501d8dce059d7c3307c022e51e1853e348439ac Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@redhat.com>
Date: Tue, 6 Jun 2023 06:35:29 -0700
Subject: [PATCH] REGRESSION(264582@main): [GTK] UI process crash: Assertion
'this->_M_is_engaged()' failed.
https://bugs.webkit.org/show_bug.cgi?id=257690
Reviewed by Carlos Garcia Campos.
I incorrectly assumed that there would always be at least one pointer
motion event before a pointer leave event. This is not correct; e.g. it
happens when Epiphany restores a previous browser session. Instead of
crashing when libstdc++ assertions are enabled, let's just bail. There
is probably no need to synthesize a fake motion event for WebCore.
* Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseLeave):
Canonical link: https://commits.webkit.org/264895@main
---
Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
index 2db371e1a1495..72a9429b02099 100644
--- a/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
+++ b/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
@@ -1650,6 +1650,9 @@ static void webkitWebViewBaseLeave(WebKitWebViewBase* webViewBase, GdkCrossingMo
return;
#endif
+ if (!priv->lastMotionEvent)
+ return;
+
// We need to synthesize a fake mouse event here to let WebCore know that the mouse has left the
// web view. Let's compute a point outside the web view that is close to the previous
// coordinates of the pointer before it left the web view. First we'll figure out which
@@ -1657,7 +1660,6 @@ static void webkitWebViewBaseLeave(WebKitWebViewBase* webViewBase, GdkCrossingMo
// pixel outside the view. This is not necessarily the closest point outside the web view, but
// it's simple to calculate and surely good enough.
- ASSERT(priv->lastMotionEvent);
int previousX = std::round(priv->lastMotionEvent->position.x());
int previousY = std::round(priv->lastMotionEvent->position.y());
int width = gtk_widget_get_width(GTK_WIDGET(webViewBase));