Re: [gtk-list] Re: gtkfilesel.c




> From: Marius Vollmer <mvo@zagadka.ping.de>
> 
> 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?

I have to admit, I don't use a debugger very often (probably once a
year - I must write good code :-) so I'm not very fluent with it.

Here is what I did and the output I got - if this isn't what you were
asking for, let me know.

> gdb main
(gdb) run
Starting program: /home/dreed/src/CS477/Lab2/main 
warning: Unable to find dynamic linker breakpoint function.
warning: GDB will be unable to debug shared library initializers
warning: and track explicitly loaded dynamic code.
wrote: /home/dreed/pub/s.rgb

Program received signal SIGSEGV, Segmentation fault.
0x400d3e66 in gtk_signal_real_emit (object=0x80c7ad8, signal_type=55, 
    args=0xbffff074) at gtksignal.c:856
856           g_return_val_if_fail (gtk_type_is_a (GTK_OBJECT_TYPE
(object), signal->info.object_type), TRUE);
Current language:  auto; currently c

I tried the fix you suggested below (and recompiled everything), but
it still bombs with exactly the same error.  Again, the error is
"random" (i.e., it may happen the second time I click on something in
the Directories list or it may happen the 10th time).

Thanks for your suggestions - do you or anyone else have any more
suggetsions?

-Dave
dreed@capital.edu

 
> 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]