Re: Some bugs in Gtk+ 1.3.1



Salmaso Raffaele <r salmaso inwind it> writes:

> Il Sat, 30 Sep 2000 23:43:09 +0200, Salmaso Raffaele
> <r salmaso inwind it> scrisse:
> 
> >Maybe a check for NULL pointers? Or they should not NULL?
> Here there are some patch
> 
> -- 
>  (o-  | Un OS per domarli, Un OS per trovarli,
>  //\  | Un OS per ghermirli e nel buio incatenarli
>  V_/_ | Nella terra di Redmond, ove l'ombra cupa scende...
> http://pinguin.linuxave.net            r punto salmaso at inwind punto it
> 
> --- gdkselection-x11.old	Fri Sep 15 08:32:31 2000
> +++ gdkselection-x11.c	Sun Oct  1 08:25:26 2000
> @@ -56,7 +56,7 @@
>    while (tmp_list)
>      {
>        OwnerInfo *info = tmp_list->data;
> -      if (info->owner == window)
> +      if (info != NULL && info->owner == window)
>  	{
>  	  owner_list = g_slist_remove (owner_list, info);
>  	  g_free (info);

There is obviously a bug somewhere, but it is not here;
an element in this list should never have ->data set to
NULL.

What is most likely happening is that a list node is getting
freed twice, and thus gets into the free list twice, and thus
gets in two different lists :-(.

I haven't seen this myself - what's the exact sequence of
actions you do to trigger this error?

> --- pangox.old	Sat Aug 26 01:14:48 2000
> +++ pangox.c	Sun Oct  1 08:22:52 2000
> @@ -133,10 +133,12 @@
>    info->font_struct = pango_x_font_cache_load (cache, info->xlfd);
>    if (!info->font_struct)
>      g_warning ("Cannot load font for XLFD '%s\n", info->xlfd);
> -  
> -  info->is_1byte = (info->font_struct->min_byte1 == 0 && info->font_struct->max_byte1 == 0);
> -  info->range_byte1 = info->font_struct->max_byte1 - info->font_struct->min_byte1 + 1;
> -  info->range_byte2 = info->font_struct->max_char_or_byte2 - info->font_struct->min_char_or_byte2 + 1;
> +  else
> +    {
> +      info->is_1byte = (info->font_struct->min_byte1 == 0 && info->font_struct->max_byte1 == 0);
> +      info->range_byte1 = info->font_struct->max_byte1 - info->font_struct->min_byte1 + 1;
> +      info->range_byte2 = info->font_struct->max_char_or_byte2 - info->font_struct->min_char_or_byte2 + 1;
> +    }
>  }
>  
>  static inline XFontStruct *

Hmmm, yes, this really needs to be fixed. I'll try to think about
what the right thing to do here is: probably something like:

    info->font_struct = pango_x_font_cache_load (cache, info->xlfd);
    if (!info->font_struct)
      {
        g_warning ("Cannot load font for XLFD '%s\n' that was that was\n"
                   "listed by the X server. This indicates some problem\n"
                   "with the X server font configuration", 
                   info->xlfd);
        info->font_struct = pango_x_font_cache_load (cache, "fixed");

        if (!info->font_struct)
          {
            g_warning ("Fatal error: cannot load fallback font 'fixed'\n")
            exit(1);
          }
      }

(The "fixed" font is guaranteed to exist by X - the X server won't
start if it can't load it; so the exit(1) should really never happen.)

Regards,
                                        Owen





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