Re: CList segfault



On Sun, Feb 25, 2001 at 11:44:31PM +0100, Daniel Elstner wrote:
> Hello again,
> 
> On 25 Feb 2001 12:41:03 -0500 Owen Taylor <otaylor redhat com> wrote:
> > 
> > Daniel Elstner <daniel elstner gmx net> writes:
> > 
> > > I have some problems with GtkCList in extended selection mode,
> > > reproduceable with the following steps:
> > > 
> > > 1. The user selects some rows _including_ the last one.
> > > 2. The program will call gtk_clist_remove() for each selected row.
> > > 3. The user changes the selection via mouse clicks before
> > >    all rows are removed.
> >
> > Well, if you provide a test case, somebody could take a look.
> 
> Here's a little test program which triggers the segfault.
> 

With below patch, test program runs just fine for me.
Try it.

--- gtk+-1.2.8/gtk/gtkclist.c.orig	Mon Feb 26 13:49:54 2001
+++ gtk+-1.2.8/gtk/gtkclist.c	Mon Feb 26 14:05:13 2001
@@ -2748,6 +2748,8 @@
     gtk_signal_emit (GTK_OBJECT (clist), clist_signals[UNSELECT_ROW],
 		     row, -1, NULL);
 
+  sync_selection (clist, row, SYNC_REMOVE);
+
   /* reset the row end pointer if we're removing at the end of the list */
   clist->rows--;
   if (clist->row_list == list)
@@ -2762,8 +2764,6 @@
 
   if (row < ROW_FROM_YPIXEL (clist, 0))
     clist->voffset += clist->row_height + CELL_SPACING;
-
-  sync_selection (clist, row, SYNC_REMOVE);
 
   if (clist->selection_mode == GTK_SELECTION_BROWSE && !clist->selection &&
       clist->focus_row >= 0)




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