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 352707 - Gtk2::RcStyle's accessors don't take undef
Gtk2::RcStyle's accessors don't take undef
Status: RESOLVED FIXED
Product: gnome-perl
Classification: Bindings
Component: Gtk2
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk2-perl-bugs
gtk2-perl-bugs
Depends on:
Blocks:
 
 
Reported: 2006-08-24 17:52 UTC by Torsten Schoenfeld
Modified: 2006-08-27 11:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Allowing undef (4.06 KB, patch)
2006-08-24 17:53 UTC, Torsten Schoenfeld
none Details | Review
Allowing undef, but not for colors (3.21 KB, patch)
2006-08-26 18:21 UTC, Torsten Schoenfeld
committed Details | Review

Description Torsten Schoenfeld 2006-08-24 17:52:55 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
Comment 1 Torsten Schoenfeld 2006-08-24 17:53:23 UTC
Created attachment 71539 [details] [review]
Allowing undef
Comment 2 muppet 2006-08-25 00:04:03 UTC
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.
Comment 3 Torsten Schoenfeld 2006-08-26 18:20:26 UTC
> 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.
Comment 4 Torsten Schoenfeld 2006-08-26 18:21:00 UTC
Created attachment 71667 [details] [review]
Allowing undef, but not for colors
Comment 5 muppet 2006-08-27 02:18:57 UTC
Looks good to me.
Comment 6 Torsten Schoenfeld 2006-08-27 11:56:52 UTC
Committed.