Re: GtkClist 1.2.8 bug and patch



Dave Lambert <dlambert acm org> writes:

> I've had seg faults from gtk_clist_optimal_column_width when the
> column is invalid.  I think I've found the problem, to which I offer
> the following patch:
> 
> --- gtkclist.c.orig	Tue Dec 12 11:49:31 2000
> +++ gtkclist.c	Tue Dec 12 11:50:23 2000
> @@ -1700,7 +1700,7 @@
>    g_return_val_if_fail (clist != NULL, 0);
>    g_return_val_if_fail (GTK_CLIST (clist), 0);
>  
> -  if (column < 0 || column > clist->columns)
> +  if (column < 0 || column >= clist->columns)
>      return 0;
>  
>    if (GTK_CLIST_SHOW_TITLES(clist) && clist->column[column].button)
> 
> Hope this helps.

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

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

 - If it is being triggered through other code in GtkClist, please
   tell us how you managed to trigger it.

Thanks,
                                        Owen




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