Re: Timer problems.



Remember, if you make mistakes in handling lists in your program,
and for instance, free a list node and keep on using it, then
GTK+/GLib may get that node from the free list. Then when
GLib manipulates the node, your data structures will become
corrupted.

This is almost certainly what is going on. There are quite
a few examples of very complex programs that use lists and
the GLib main loop that don't hit the problem, so I would
really have to suspect something in your code.

Regards,
                                        Owen

Dylan Griffiths <dylang+gtk_devel@thock.com> writes:

> (*Note: This is a resend because the mailing list doesn't like my other
> address)
>        
>         Hello.  I think I've found a problem with the timer code in glib
> 1.2.8.  My
> program initializes a gtk timer to call back every 5 seconds.  At each
> callback, it walks along a linked list of a parsed XML document and
> retrieves some data, which it displays.  The problem is that one of my
> pointers (which I am using as the one end point of one of the linked lists I
> use) seems to be "changing" after the first callback.  This leads to some
> segfaults as the program follows invalid pointers.
> 
> first_link is the "first" link in a linked list of information about RDF
> sites (basically, the URL which it retrieves RDF data from).
> In the test case, the first_link->url member was 
> "http://www.kuro5hin.org/backend.rdf"
> After the first callback, the pointer is suddenly 
> " `@Y `@Yww.kuro5hin.org/backend.rdf"
> and other members are also "touched"
> 
> Using gdb, I traced the corruption point into the glib functions.  I have
> not gone any further with it.
> 
> The code to the application can be downloaded here:
> http://www.thock.com/Dylan/code/k5app_0.3.tar.gz
> 
> Any help, even a "you did this wrong, bonehead" would be greatly
> appreciated, as I've been banging my skull against this thing for 3 hours
> now :-/
> -- 
>     www.kuro5hin.org -- more than a state of mind.
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list




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