Re: [gtk-list] bug in gtk_clist_swap_rows() ?



On 11/23/98 Michael Elkins uttered the following other thing:
> I'm using gtk+ 1.1.2 and no matter what I do, I'm getting a segfault in
> gtk_clist_swap_rows().  Is it just broken in 1.1.2?

Yes, its broken.  I emailed a bug report and patch last week to gtk-list
about it, but it doesn't look like its in the latest cvs version.

The patch is attached:

Brandon
-- 
 Brandon Long       "I refuse to believe the afterlife is run by you.
 MD6 Crash Test Dummy     The world is not so badly designed."
 Intel Corporation              -- Picard to Q in STTNG/Tapestry
          I'm too low on the totem pole to speak for Intel.
                  http://www.fiction.net/blong/
Index: gtkclist.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkclist.c,v
retrieving revision 1.109
diff -u -r1.109 gtkclist.c
--- gtkclist.c	1998/11/11 20:46:47	1.109
+++ gtkclist.c	1998/11/18 07:52:56
@@ -2802,7 +2802,7 @@
   last = MAX (row1, row2);
 
   link1 = g_list_nth (clist->row_list, first);
-  link2 = g_list_nth (link1, row2 - row1);
+  link2 = g_list_nth (link1, last - first);
 
   swap = link1->data;
   link1->data = link2->data;
@@ -2813,8 +2813,7 @@
     {
       if (GPOINTER_TO_INT (list->data) == row1)
 	list->data = GINT_TO_POINTER (row2);
-      
-      if (GPOINTER_TO_INT (list->data) == row2)
+      else if (GPOINTER_TO_INT (list->data) == row2)
 	list->data = GINT_TO_POINTER (row1);
       
       list = list->next;
@@ -2822,13 +2821,13 @@
   
   if (!GTK_CLIST_FROZEN (clist))
     {
-      if (gtk_clist_row_is_visible (clist, row1) != GTK_VISIBILITY_NONE)
+      if (gtk_clist_row_is_visible (clist, last) != GTK_VISIBILITY_NONE)
 	GTK_CLIST_CLASS_FW (clist)->draw_row
-	  (clist, NULL, row1, GTK_CLIST_ROW (link2));
+	  (clist, NULL, last, GTK_CLIST_ROW (link2));
 
-      if (gtk_clist_row_is_visible (clist, row2) != GTK_VISIBILITY_NONE)
+      if (gtk_clist_row_is_visible (clist, first) != GTK_VISIBILITY_NONE)
 	GTK_CLIST_CLASS_FW (clist)->draw_row
-	  (clist, NULL, row2, GTK_CLIST_ROW (link1));
+	  (clist, NULL, first, GTK_CLIST_ROW (link1));
     }
 }
 


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