Re: GtkClist 1.2.8 bug and patch



>>>>> "Owen" == Owen Taylor <otaylor redhat com> writes:

Owen> OK, fixed in both stable and head. Of course, calling 
Owen> gtk_clist_optimal_column_width() with an out-of-range index
Owen> is a bug and undefined behavior, so:

Owen>  - If it is in your code, don't do it - GTK+ could very well
Owen>    warn about this in the in the future or even crash with
Owen>    debugging turned off.

Of course the problem was in my code :) A warning would, indeed, be
better.  How about this (against an unpatched 1.2.8):


--- gtkclist.c.orig	Thu Dec 14 09:54:50 2000
+++ gtkclist.c	Thu Dec 14 09:55:38 2000
@@ -1699,9 +1699,7 @@
 
   g_return_val_if_fail (clist != NULL, 0);
   g_return_val_if_fail (GTK_CLIST (clist), 0);
-
-  if (column < 0 || column > clist->columns)
-    return 0;
+  g_return_val_if_fail (column < 0 || column >= clist->columns, 0);
 
   if (GTK_CLIST_SHOW_TITLES(clist) && clist->column[column].button)
     width = (clist->column[column].button->requisition.width)



Thanks,
Dave

-- 
Dave Lambert		mailto://dlambert acm org
Portsmouth, England	phone-home://+44 23 9236 5439
[This space for sale]	phone-work://+44 23 9233 6272
--
Don't force it: get a bigger hammer.





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