GNOME Bugzilla – Bug 342458
Stock menu items without icons are broken in recent GTK+ releases.
Last modified: 2011-02-04 16:10:27 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.
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.
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.