RESOLVED FIXED 173417
[GTK] Stop using GtkAction in WebPopupMenuProxyGtk
https://bugs.webkit.org/show_bug.cgi?id=173417
Summary [GTK] Stop using GtkAction in WebPopupMenuProxyGtk
Adrian Perez
Reported 2017-06-15 05:48:25 PDT
There are two reasons to stop using it: - GtkAction has been deprecated in GTK+ 3.10, and most likely it will not be available in GTK+ 4.x; GAction is recommended instead. - The additional functionality from GtkAction is not used. It should be possible to directly construct the needed GtkMenuItems without creating a GtkAction first.
Attachments
Patch (5.46 KB, patch)
2017-06-15 05:54 PDT, Adrian Perez
no flags
Adrian Perez
Comment 1 2017-06-15 05:54:16 PDT
Michael Catanzaro
Comment 2 2017-06-15 06:00:57 PDT
Comment on attachment 312974 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=312974&action=review Nice! > Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp:68 > gtk_menu_shell_append(GTK_MENU_SHELL(m_popup), menuItem); Is this really transfer full? It's not documented that way at all. I suspect it's a bindings error, but otherwise it looks like the GtkMenuItem has always been leaked here. Can you check it?
Carlos Garcia Campos
Comment 3 2017-06-15 06:05:40 PDT
Comment on attachment 312974 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=312974&action=review >> Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp:68 >> gtk_menu_shell_append(GTK_MENU_SHELL(m_popup), menuItem); > > Is this really transfer full? It's not documented that way at all. I suspect it's a bindings error, but otherwise it looks like the GtkMenuItem has always been leaked here. Can you check it? Widgets are initially unowned, and adding them to a container always transfers the ownership to the container, the floating ref is consumed by the container.
Adrian Perez
Comment 4 2017-06-15 06:28:50 PDT
(In reply to Carlos Garcia Campos from comment #3) > Comment on attachment 312974 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=312974&action=review > > >> Source/WebKit2/UIProcess/gtk/WebPopupMenuProxyGtk.cpp:68 > >> gtk_menu_shell_append(GTK_MENU_SHELL(m_popup), menuItem); > > > > Is this really transfer full? It's not documented that way at all. I suspect it's a bindings error, but otherwise it looks like the GtkMenuItem has always been leaked here. Can you check it? > > Widgets are initially unowned, and adding them to a container always > transfers the ownership to the container, the floating ref is consumed by > the container. Yes, this is what happens here as well. Just for the sake of completeness, I checked the source code and the chain of function calls inside GTK+, and indeed g_object_ref_sink ends up being called as expected: gtk_menu_shell_append [gtkmenushell.c] gtk_menu_shell_insert gtk_menu_shell_real_insert gtk_widget_set_parent [gtkwidget.c] gtk_widget_insert_after gtk_widget_reposition_after g_object_ref_sink :-)
WebKit Commit Bot
Comment 5 2017-06-15 07:03:06 PDT
Comment on attachment 312974 [details] Patch Clearing flags on attachment: 312974 Committed r218329: <http://trac.webkit.org/changeset/218329>
WebKit Commit Bot
Comment 6 2017-06-15 07:03:08 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.