Bad assertions in GtkEntry



I noticed looking thought the GtkEntry code that there a quite a few
functions that have things like this

/* -------------- start of example --- */
gtk_entry_some_sort_of_function (GtkWidget *widget, ...)
{
   GtkEntry *entry;

   g_return_if_fail (entry != NULL);
   .. rest of code
/* ------- end of example ---- */

The assertion generally passes, because the un-initialized value of entry
is != NULL, but I am sure this is not what the author intended.

should be g_return_if_fail (widget != NULL), after which you can safely
assign    entry = GTK_ENTRY(widget)

  -------------------------------------
After a week with GTK+, I can now do more with less code than in Java.
Still a lot to learn though.


-------------------------------------------------------------------------------
     Coding GTK+ is like playing cards with Bill Gates :

"Upping the ante, I know you gotta see me,
 Read em and weep - the dead man's hand again,
 I see it in your eyes - take one look and die,
 There's only one card I need - you know it's gonna be,
 The Ace of Spades - The Ace of Spades"  - Motorhead.
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]