Title: [275940] trunk/Tools
Revision
275940
Author
[email protected]
Date
2021-04-14 03:03:10 -0700 (Wed, 14 Apr 2021)

Log Message

[GTK4] Use a while loop in PlatformWebView::dismissAllPopupMenus()
https://bugs.webkit.org/show_bug.cgi?id=224534

Patch by Carlos Garcia Campos <[email protected]> on 2021-04-14
Reviewed by Philippe Normand.

The child might be destroyed during the loop iteration. Using a while loop we ensure we get the next sibling
before the current child is destroyed.

* WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
(WTR::PlatformWebView::dismissAllPopupMenus):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (275939 => 275940)


--- trunk/Tools/ChangeLog	2021-04-14 09:45:49 UTC (rev 275939)
+++ trunk/Tools/ChangeLog	2021-04-14 10:03:10 UTC (rev 275940)
@@ -1,3 +1,16 @@
+2021-04-14  Carlos Garcia Campos  <[email protected]>
+
+        [GTK4] Use a while loop in PlatformWebView::dismissAllPopupMenus()
+        https://bugs.webkit.org/show_bug.cgi?id=224534
+
+        Reviewed by Philippe Normand.
+
+        The child might be destroyed during the loop iteration. Using a while loop we ensure we get the next sibling
+        before the current child is destroyed.
+
+        * WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
+        (WTR::PlatformWebView::dismissAllPopupMenus):
+
 2021-04-14  Miguel Gomez  <[email protected]>
 
         [GTK][WPE] Add a property to the WebKitWebView indicating whether the web process is responsive

Modified: trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp (275939 => 275940)


--- trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp	2021-04-14 09:45:49 UTC (rev 275939)
+++ trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp	2021-04-14 10:03:10 UTC (rev 275940)
@@ -248,9 +248,13 @@
 void PlatformWebView::dismissAllPopupMenus()
 {
 #if USE(GTK4)
-    for (auto* child = gtk_widget_get_first_child(GTK_WIDGET(m_view)); child; child = gtk_widget_get_next_sibling(child)) {
+    auto* child = gtk_widget_get_first_child(GTK_WIDGET(m_view));
+    while (child) {
+        auto* next = gtk_widget_get_next_sibling(child);
         if (GTK_IS_POPOVER(child))
             gtk_widget_hide(child);
+
+        child = next;
     }
 #else
     // gtk_menu_popdown doesn't modify the GList of attached menus, so it should
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to