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 376443 - gtk_image_menu_item_new_with_label / gtk_image_menu_item_new_with_mnemonic have incorrect initial ref_count
gtk_image_menu_item_new_with_label / gtk_image_menu_item_new_with_mnemonic ha...
Status: RESOLVED DUPLICATE of bug 344858
Product: gtk+
Classification: Platform
Component: Widget: Other
2.10.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-11-17 20:07 UTC by Daniel Atallah
Modified: 2007-04-16 12:04 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Daniel Atallah 2006-11-17 20:07:13 UTC
When a menu item is created with gtk_image_menu_item_new_with_label() or gtk_image_menu_item_new_with_mnemonic(), it will start life with a ref_count of 2.

This means that it will not be destroyed when removed from the container it is added to using gtk_container_remove(). (I realize that you can use gtk_widget_destroy() instead of gtk_container_remove() and it will make sure that the the menu item is removed and destroyed.)

The problem appears to be that gtk_accel_label_set_accel_widget() is called in the gtk_image_menu_item_new...() methods, which adds an additional ref_count.  Perhaps the menu item should simply be unreffed after the gtk_accel_label_set_accel_widget() call?
Comment 1 Xan Lopez 2007-03-01 18:04:14 UTC
I'd say this applies to gtk_menu_item_new_with_{label,mnmemonic} too.
Comment 2 Tommi Komulainen 2007-03-02 14:18:20 UTC
See bug 344858
Comment 3 Emmanuele Bassi (:ebassi) 2007-04-16 12:04:04 UTC
indeed, this is a dupe.

*** This bug has been marked as a duplicate of 344858 ***