GtkClist, removing the last object.



I found a work arround for the crash that was beeing
caused when removing all the object from a 
GtkCList. The solution was to call :

gtk_clist_clear (list); 

when removing the last object from the list. 
Here is a patch that fixes this problem in gtk+.
There migth be a better way to fix this, since
I am not yet familiar with gtk+ internals, but
non the less, here it goes.


The problem that was causing this bugs seemed to 
be that we where not setting the adjustements to
0 when removing the last object. But clearing the
list seems a cleaner way /me thinks.

Chema
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.1061.2.266
diff -u -5 -r1.1061.2.266 ChangeLog
--- ChangeLog	2000/06/18 13:55:14	1.1061.2.266
+++ ChangeLog	2000/07/01 06:30:40
@@ -1,5 +1,10 @@
+Sat Jul 01 01:29:00 2000  Chema Celorio  <chema@celorio.com>
+
+	* gtk/gtkclist.c (real_remove_row): when removing the last row
+	of a list, call the clear function.
+
 Sun Jun 18 15:35:35 2000  Pablo Saratxaga <pablo@mandrakesoft.com>
 
 	* gtk/gtkrc.cp1251,gtk/Makefile.am: the cp1251 is also used by
 	Byelorussian language; changed the Makefile and file names 
 	to reflect that.
Index: gtk/gtkclist.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkclist.c,v
retrieving revision 1.156.2.18
diff -u -5 -r1.156.2.18 gtkclist.c
--- gtk/gtkclist.c	2000/02/29 13:28:11	1.156.2.18
+++ gtk/gtkclist.c	2000/07/01 06:30:54
@@ -2730,10 +2730,16 @@
 
   /* return if out of bounds */
   if (row < 0 || row > (clist->rows - 1))
     return;
 
+  if (clist->rows == 1)
+  {
+       GTK_CLIST_CLASS_FW (clist)->clear (clist);
+       return;
+  }
+
   was_visible = (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE);
   was_selected = 0;
 
   /* get the row we're going to delete */
   list = ROW_ELEMENT (clist, row);


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