Re: testgtk crashes in bsearch



Following up on my own mail.

I have found that the following change fixes the problem. May I commit?

Padraig

cvs server: Diffing .
Index: gtkstyle.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkstyle.c,v
retrieving revision 1.76
diff -u -p -r1.76 gtkstyle.c
--- gtkstyle.c  2001/09/08 17:55:02     1.76
+++ gtkstyle.c  2001/09/10 10:03:03
@@ -1307,12 +1307,16 @@ _gtk_style_peek_property_value (GtkStyle
   /* lookup, or insert value if not yet present */
   key.widget_type = widget_type;
   key.pspec = pspec;
-  pcache = bsearch (&key,
-                   style->property_cache->data, style->property_cache->len,
-                   sizeof (PropertyValue), style_property_values_cmp);
-  if (pcache)
-    return &pcache->value;
 
+  if (style->property_cache->len > 0)
+  {
+    /* On Solaris bsearch does not check that the length is non-zero */
+    pcache = bsearch (&key,
+                     style->property_cache->data, style->property_cache->len,
+                     sizeof (PropertyValue), style_property_values_cmp);
+    if (pcache)
+      return &pcache->value;
+  }
   i = 0;
   while (i < style->property_cache->len &&
         style_property_values_cmp (&key, &g_array_index (style->property_cache, 
PropertyValue, i)) >= 0)

> Delivered-To: gtk-devel-list gnome org
> Subject: testgtk crashes in bsearch
> To: gtk-devel-list gnome org
> MIME-Version: 1.0
> Content-MD5: svRbsyW/jjPglRr014F+zQ==
> X-BeenThere: gtk-devel-list gnome org
> X-Loop: gtk-devel-list gnome org
> X-Mailman-Version: 2.0.5
> List-Help: <mailto:gtk-devel-list-request gnome org?subject=help>
> List-Post: <mailto:gtk-devel-list gnome org>
> List-Subscribe: <http://mail.gnome.org/mailman/listinfo/gtk-devel-list>, 
<mailto:gtk-devel-list-request gnome org?subject=subscribe>
> List-Id: Development of GTK+ <gtk-devel-list.gnome.org>
> List-Unsubscribe: <http://mail.gnome.org/mailman/listinfo/gtk-devel-list>, 
<mailto:gtk-devel-list-request gnome org?subject=unsubscribe>
> List-Archive: <http://mail.gnome.org/archives/gtk-devel-list/>
> 
> I updated to latest glib, pango, gtk+ this morning and found that testgtk 
> crashes on Solaris 8 with the following stack trace
> 
> =>[1] style_property_values_cmp(0xffbeb1d0, 0x0, 0xffffffff, 0x0, 0xff3e0000, 
> 0xff3b1f08), at 0xff051568
>   [2] bsearch(0x60, 0xffffffd0, 0x0, 0x30, 0x0, 0xff051540), at 0xfe935878
>   [3] _gtk_style_peek_property_value(0xbc690, 0x2012, 0x71520, 0x0, 
0xff3e0000, 
> 0xff3b0b0c), at 0xff051a04
>   [4] gtk_widget_style_get_valist(0x88ea0, 0xff1b5330, 0xffbeb3ec, 0x0, 
0x7b1d0, 
> 0x80), at 0xff151e1c
>   [5] gtk_widget_style_get(0x88ea0, 0xff1b5330, 0xffbeb43c, 0xff1b5348, 
0xffbeb4
> ...
> 
> I assume that it is related to the following change.
> 
> ------------- Begin Included Message -------------
> 
> Sat Sep  8 13:53:09 2001  Owen Taylor  <otaylor redhat com>
> 
>         * gtk/gtkrc.[ch] gtk/gtkstyle.[ch]: Replace uses of GBSearchArray
>         with GArray and bsearch(), to remove dependency on a still
>         evolving interface that we want to keep private to glib/gobject.
> 
> ------------- End Included Message -------------
> 
> Has anyone experienced this on another platform?
> 
> Padraig
> 
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list





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