[10349] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

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

daemon@ATHENA.MIT.EDU (Brandon Long)
Mon Nov 23 21:48:20 1998

Date: Mon, 23 Nov 1998 18:47:32 -0800
From: Brandon Long <blong@fiction.net>
To: gtk-list@redhat.com
Reply-To: blong@fiction.net
Mail-Followup-To: gtk-list@redhat.com
In-Reply-To: <19981123180408.A25762@tis.com>; from Michael Elkins on Mon, Nov 23, 1998 at 06:04:08PM -0800
Resent-From: gtk-list@redhat.com


--YZ5djTAD1cGYuMQK
Content-Type: text/plain; charset=us-ascii

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/

--YZ5djTAD1cGYuMQK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="clist.diff"

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));
     }
 }
 

--YZ5djTAD1cGYuMQK--

-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post