Title: [121945] trunk/Source/WebCore
Revision
121945
Author
[email protected]
Date
2012-07-05 23:27:30 -0700 (Thu, 05 Jul 2012)

Log Message

[GTK] Showing the context menu in the Web Inspector can crash the browser
https://bugs.webkit.org/show_bug.cgi?id=88800

Patch by Arnaud Renevier <[email protected]> on 2012-07-05
Reviewed by Carlos Garcia Campos.

Remove ContextMenuItem from its parent before appending it again to a
new parent

No new tests, behavior is unchanged.

* platform/gtk/ContextMenuGtk.cpp:
(WebCore::ContextMenu::appendItem):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121944 => 121945)


--- trunk/Source/WebCore/ChangeLog	2012-07-06 06:07:52 UTC (rev 121944)
+++ trunk/Source/WebCore/ChangeLog	2012-07-06 06:27:30 UTC (rev 121945)
@@ -1,3 +1,18 @@
+2012-07-05  Arnaud Renevier  <[email protected]>
+
+        [GTK] Showing the context menu in the Web Inspector can crash the browser
+        https://bugs.webkit.org/show_bug.cgi?id=88800
+
+        Reviewed by Carlos Garcia Campos.
+
+        Remove ContextMenuItem from its parent before appending it again to a
+        new parent
+
+        No new tests, behavior is unchanged.
+
+        * platform/gtk/ContextMenuGtk.cpp:
+        (WebCore::ContextMenu::appendItem):
+
 2012-07-05  Dongwoo Im  <[email protected]>
 
         [EFL] Unreviewed, Fix build break when WEB_AUDIO is enabled.

Modified: trunk/Source/WebCore/platform/gtk/ContextMenuGtk.cpp (121944 => 121945)


--- trunk/Source/WebCore/platform/gtk/ContextMenuGtk.cpp	2012-07-06 06:07:52 UTC (rev 121944)
+++ trunk/Source/WebCore/platform/gtk/ContextMenuGtk.cpp	2012-07-06 06:27:30 UTC (rev 121945)
@@ -23,8 +23,9 @@
 
 #include "ContextMenu.h"
 
+#include <gtk/gtk.h>
 #include <wtf/gobject/GOwnPtr.h>
-#include <gtk/gtk.h>
+#include <wtf/gobject/GRefPtr.h>
 
 namespace WebCore {
 
@@ -48,10 +49,14 @@
 {
     ASSERT(m_platformDescription);
 
-    GtkMenuItem* platformItem = item.releasePlatformDescription();
+    GRefPtr<GtkWidget> platformItem = GTK_WIDGET(item.releasePlatformDescription());
     ASSERT(platformItem);
-    gtk_menu_shell_append(GTK_MENU_SHELL(m_platformDescription), GTK_WIDGET(platformItem));
-    gtk_widget_show(GTK_WIDGET(platformItem));
+
+    if (GtkWidget* parent = gtk_widget_get_parent(platformItem.get()))
+        gtk_container_remove(GTK_CONTAINER(parent), platformItem.get());
+
+    gtk_menu_shell_append(GTK_MENU_SHELL(m_platformDescription), platformItem.get());
+    gtk_widget_show(platformItem.get());
 }
 
 void ContextMenu::setPlatformDescription(PlatformMenuDescription menu)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to