Bug in gtk_tree_data_list_compare_func



This function doesn't handle sorting on a column that holds boolean
values.  The error message is:

(gnucash:27003): GLib-GObject-CRITICAL **: file gvaluetypes.c: line 613
(g_value_get_int): assertion `G_VALUE_HOLDS_INT (value)' failed

The code errors because this function uses gvalue integer functions on a
gvalue that is of boolean type. This exists in both the 2.2 branch and
on HEAD.  (Its also in 2.0, fwiw.  Looks like a day one bug.)  A patch
is attached below.

David


david hampton-pc:gtk+-2.2$ cvs diff gtk/gtktreedatalist.c
Index: gtk/gtktreedatalist.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreedatalist.c,v
retrieving revision 1.27
diff -u -r1.27 gtktreedatalist.c
--- gtk/gtktreedatalist.c	7 Oct 2002 19:10:39 -0000	1.27
+++ gtk/gtktreedatalist.c	20 Nov 2003 04:19:30 -0000
@@ -314,9 +314,9 @@
   switch (G_TYPE_FUNDAMENTAL (type))
     {
     case G_TYPE_BOOLEAN:
-      if (g_value_get_int (&a_value) < g_value_get_int (&b_value))
+      if (g_value_get_boolean (&a_value) < g_value_get_boolean (&b_value))
 	retval = -1;
-      else if (g_value_get_int (&a_value) == g_value_get_int (&b_value))
+      else if (g_value_get_boolean (&a_value) == g_value_get_boolean (&b_value))
 	retval = 0;
       else
 	retval = 1;

Attachment: signature.asc
Description: This is a digitally signed message part



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