On Sat, Sep 24, 2005 at 06:47:45PM +0200, Torsten Schoenfeld <kaffeetisch gmx de> wrote: Thanks for your reaction :)
Haven't stumbled over htem yet, but thinking about it, it seems SvGdkGCValues and similar structure-setting fucntions are all broken in the same way: there is no way to reset pointers, as Gtk2 enforces them to be non-NULL.Most converters complain loudly if they stumble upon an undefined value, yes. That's been our policy because it's the correct thing to do in nearly all cases.
"Nearly all cases" seems to be very wrong, though, at least with regards to structure converters, where the opposite seems the norm. I'm not arguing the policy, but that policy incidentally makes correct programs broken when a mistake is made (and such mistakes are extremely common in Gtk2), while the opposite policy would not break correct code, but would only allow broken code (actually, the gtk+ functions themselves usually complain loudly). A policy of allowing undef when in doubt/per default and using the non-_ornull functions would result in the same result if there are no bugs, and in a rather more useful situation if there are bugs.
When a function does allow NULL, we simply add _ornull manually -- just like you did in the patch.
Is there any reason why it didn't get applied? In any case, I attached it again, with an additional similar fix.
(In the bright, not-so-distant introspection future, this will be automatic: parameter definitions state if NULL is allowed or not.)
Actually, most breakage isn't in parameters, it seems. In any case, this doesn't solve the original problem on having no clear documentation on this (in gtk+) and Gtk2 being unusable for nontrivial scripts due to these issues (fortunately, I seem to be the only one using Gtk2 for more than a prebuilt widget toolbox, so it isn't a big problem, as I can fix it). OTOH, fixing it is a bit frustrating if my patches get ignored, as is the case, as so far no comment on the patch did arrive nor was it applied. -- The choice of a -----==- _GNU_ ----==-- _ generation Marc Lehmann ---==---(_)__ __ ____ __ pcg goof com --==---/ / _ \/ // /\ \/ / http://schmorp.de/ -=====/_/_//_/\_,_/ /_/\_\ XX11-RIPE
Attachment:
gtk2.diff
Description: Text document