After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 645483 - GtkToolItem's handling of ->priv->menu_item
GtkToolItem's handling of ->priv->menu_item
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkToolbar
2.22.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-03-22 01:20 UTC by Morten Welinder
Modified: 2018-02-10 04:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch with debug code (2.36 KB, patch)
2011-04-06 23:43 UTC, Morten Welinder
none Details | Review

Description Morten Welinder 2011-03-22 01:20:08 UTC
->priv->menu_item is a GtkWidget created by gtk_action_create_menu_item.
It should not be assumed to have and keep a ref-count of 1.

Therefore, it should be explicitly destroyed by gtk_tool_item_dispose
and, perhaps, gtk_tool_item_set_proxy_menu_item.

Relatedly, the current contents of gtk_tool_item_finalize seems to be
more appropriate for gtk_tool_item_dispose.  (But then the items need
to be zeroed.)
Comment 1 Morten Welinder 2011-03-26 00:36:40 UTC
I should add that Gtk+ is perfectly capable of supplying that second ref
all by itself.  I.e., whenever an overflow menu item is created, it is leaked.
This didn't use to be the case.

The extra ref seems to be set deep down in gtk_accel_label_set_accel_widget,
unless I'm mistaken.
Comment 2 Morten Welinder 2011-04-06 23:37:13 UTC
It's a case of circular links:

GtkMenuItem holds a ref to its child, a GtkAccelLabel.
The GtkAccelLabel holds a ref to the GtkMenuItem as its "accel widget".

Something needs to break those links.  The upcoming patch works for me.
Note: contain debug code.

Offline CC-ing jpetersen@openismus.com who appears to have refactored
GtkMenuItem to create the ref loop.
Comment 3 Morten Welinder 2011-04-06 23:43:49 UTC
Created attachment 185376 [details] [review]
Patch with debug code
Comment 4 Matthias Clasen 2018-02-10 04:37:32 UTC
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and
still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue
for it.