Changeset 121945 in webkit


Ignore:
Timestamp:
Jul 5, 2012 11:27:30 PM (12 years ago)
Author:
commit-queue@webkit.org
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 <arno@renevier.net> 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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r121938 r121945  
     12012-07-05  Arnaud Renevier  <arno@renevier.net>
     2
     3        [GTK] Showing the context menu in the Web Inspector can crash the browser
     4        https://bugs.webkit.org/show_bug.cgi?id=88800
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Remove ContextMenuItem from its parent before appending it again to a
     9        new parent
     10
     11        No new tests, behavior is unchanged.
     12
     13        * platform/gtk/ContextMenuGtk.cpp:
     14        (WebCore::ContextMenu::appendItem):
     15
    1162012-07-05  Dongwoo Im  <dw.im@samsung.com>
    217
  • trunk/Source/WebCore/platform/gtk/ContextMenuGtk.cpp

    r113147 r121945  
    2424#include "ContextMenu.h"
    2525
     26#include <gtk/gtk.h>
    2627#include <wtf/gobject/GOwnPtr.h>
    27 #include <gtk/gtk.h>
     28#include <wtf/gobject/GRefPtr.h>
    2829
    2930namespace WebCore {
     
    4950    ASSERT(m_platformDescription);
    5051
    51     GtkMenuItem* platformItem = item.releasePlatformDescription();
     52    GRefPtr<GtkWidget> platformItem = GTK_WIDGET(item.releasePlatformDescription());
    5253    ASSERT(platformItem);
    53     gtk_menu_shell_append(GTK_MENU_SHELL(m_platformDescription), GTK_WIDGET(platformItem));
    54     gtk_widget_show(GTK_WIDGET(platformItem));
     54
     55    if (GtkWidget* parent = gtk_widget_get_parent(platformItem.get()))
     56        gtk_container_remove(GTK_CONTAINER(parent), platformItem.get());
     57
     58    gtk_menu_shell_append(GTK_MENU_SHELL(m_platformDescription), platformItem.get());
     59    gtk_widget_show(platformItem.get());
    5560}
    5661
Note: See TracChangeset for help on using the changeset viewer.