GNOME Bugzilla – Bug 352707
Gtk2::RcStyle's accessors don't take undef
Last modified: 2006-08-27 11:56:52 UTC
The accessors name, font_desc, bg_pixmap_name, fg, bg, text, and base don't allow undef for the new value. It seems they should[1]. Patch attached. Does it make sense to zero out the color structs if the color accessors see undef? [1] http://sourceforge.net/tracker/index.php?func=detail&aid=1484752&group_id=64773&atid=508618
Created attachment 71539 [details] [review] Allowing undef
The sourceforge tracker bug is about gtk_widget_modify_foo(), which should, indeed, allow NULL. For the color accesors on the GdkStyle structure, on the other hand, since you're effectively modifying the actual GdkColor whose memory is allocated right there in the struct (not a pointer to it), i don't think that allowing undef makes sense. Setting all members to zero sets the color to black, which is not the intent of passing undef to modify_foo() to undo local changes. For the font description and backing pixmap pointers, i'd have to dig through sources (which i'm not able to do at the moment), but i think allowing undef to NULL these pointers probably makes good sense.
> The sourceforge tracker bug is about gtk_widget_modify_foo(), which should, > indeed, allow NULL. You already fixed this. :-) > For the color accesors on the GdkStyle structure, on the other hand, since > you're effectively modifying the actual GdkColor whose memory is allocated > right there in the struct (not a pointer to it), i don't think that allowing > undef makes sense. Yeah, it didn't feel right. New patch without this attached.
Created attachment 71667 [details] [review] Allowing undef, but not for colors
Looks good to me.
Committed.