[Webkit-unassigned] [Bug 39102] [GTK] eventSender.contextClick() should return the contents of the context menu
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Sep 15 07:50:40 PDT 2010
https://bugs.webkit.org/show_bug.cgi?id=39102
Eric Carlson <eric.carlson at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #67534|review? |review+
Flag| |
--- Comment #4 from Eric Carlson <eric.carlson at apple.com> 2010-09-15 07:50:40 PST ---
(From update of attachment 67534)
> + JSValueRef valueRef = JSObjectMakeArray(context, 0, NULL, NULL);
> + WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
> + GtkMenu* gtkMenu = webkit_web_view_get_context_menu(view);
> + if (gtkMenu) {
> + GList* items = gtk_container_get_children(GTK_CONTAINER(gtkMenu));
> + JSValueRef arrayValues[g_list_length(items)];
> + int index = 0;
> + for (GList* item = g_list_first(items); item; item = g_list_next(item)) {
> + const gchar* label;
> + if (GTK_IS_SEPARATOR_MENU_ITEM(item->data))
> + label = g_strdup("<separator>");
> + else
> + label = g_strdup(gtk_menu_item_get_label(GTK_MENU_ITEM(item->data)));
> +
> + arrayValues[index] = JSValueMakeString(context, JSStringCreateWithUTF8CString(label));
> + index++;
> + }
> + if (index)
> + valueRef = JSObjectMakeArray(context, index - 1, arrayValues, NULL);
Aren't you leaking the label string allocated for arrayValues?
I am definitely not a GTK expert so you might want to get another opinion, but this looks correct to me.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list