Re: [gtk-list] gtkfilesel.c



Dave Reed <dreed@capital.edu> writes:

> At random times while using the file selection dialog (usually while
> double clicking "../" in the Directories window), I get the following:
> 
> ** ERROR **: sigsegv caught

I had the same problem while testing the ref_count stuff.  I think
there might be some race conditions in Gtk that only show up in rare
situations.

Can you identify the exact spot where the segv occurs, by letting it
crash in the debugger?

IIRC, my problem was that gtk_get_event_widget sometimes returns NULL
when the event belonged to a widget that had already been destroyed
(the right thing to do).  But not all callers of gtk_get_event_widget
could handle those NULLs.

I think the fileselector crash can be cured by just fixing
gtk_list_button_press.  Like so, in gtklist.c:

static gint
gtk_list_button_press (GtkWidget      *widget,
		       GdkEventButton *event)
{
  GtkList *list;
  GtkWidget *item;

  g_return_val_if_fail (widget != NULL, FALSE);
  g_return_val_if_fail (GTK_IS_LIST (widget), FALSE);
  g_return_val_if_fail (event != NULL, FALSE);

  list = GTK_LIST (widget);
  item = gtk_get_event_widget ((GdkEvent*) event);

  if (item == NULL)   /* this is new */
    return FALSE;

  while (!gtk_type_is_a (GTK_WIDGET_TYPE (item), gtk_list_item_get_type ()))
    item = item->parent;

  gtk_list_select_child (list, item);

  return FALSE;
}



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