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 342458 - Stock menu items without icons are broken in recent GTK+ releases.
Stock menu items without icons are broken in recent GTK+ releases.
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: UIManager / Actions
2.9.x
Other Linux
: Normal major
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-05-21 03:09 UTC by Callum McKenzie
Modified: 2011-02-04 16:10 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16



Description Callum McKenzie 2006-05-21 03:09:59 UTC
In gnome-games we use our own stock items extensively to keep UI terminology consistent. For some of these items we haven't come up with decent icons yet. When these stock items are used in a menu with GTK+ from CVS after March 13 2006 a warning is displayed and the menu item is left blank (no label!).

The warnings is typically:

(gnometris:10647): Gtk-CRITICAL **: gtk_label_set_label: assertion `str != NULL' failed

This can be seen with both gnometris and gnibbles in the Games menu where the "End Game" option goes missing (any version post 2.10 should show this behaviour, not just 2.15).

The change to GTK+ in question appears to be:

http://cvs.gnome.org/viewcvs/gtk%2B/gtk/gtkactiongroup.c?r1=1.55&r2=1.56

Either adding a stock icon or reverting the change in GTK+ fixes the issue.

It isn't clear to me that reverting the change is the best thing to do since it appears to me that things only worked as an inadvertant side-effect. I won't claim to understand the code properly.
Comment 1 Matthias Clasen 2006-05-22 04:37:07 UTC
Ugh, thats ugly. 

The change was done in order to allow using the stock-id field
in GtkActionEntry for named (non-stock) icons as well. That 
obviously conflicts with iconless stock items.

One possible way to resolve this might be to set both stock-id and
icon-name, and handle the fallback from stock icon to themed icon
in GtkAction code.
Comment 2 Matthias Clasen 2006-06-20 18:01:37 UTC
2006-06-20  Matthias Clasen  <mclasen@redhat.com>

	Fix handling of stock items without icons in action-based
	ui.  (#342458, Callum McKenzie)
	
	* gtk/gtkactiongroup.c (gtk_action_group_add_actions_full): Set
	the stock id even if there is no icon for it.

	* gtk/gtkaction.c (connect_proxy): 
	* gtk/gtktoolbutton.c (gtk_tool_button_construct_contents): Only
	construct a stock icon if the stock item has an icon.