Re: question on g_list_insert_sorted () usage



Hi,

Many thanks! I think I should let you know that g_list_append works fine, except that it does not give me a sorted list by ctime (creation time). org. The debugger crashes just after entering the function at the point of the "return statement".

Program received signal SIGSEGV, Segmentation fault.
0x0804db2b in compare_ctime (a=0x8ef5ae0, b=0x0) at count.c:19
/usr/local/aarem/Desktop/gbuffy-0.2.6/count.c:19:339:beg:0x804db2b

Btw, I am sorting by the ctime, the creation time of the messages in the mh folder.

Many thanks,
aarem


Hello Aarem,

On Thu, Jun 22, 2006 at 05:00:50PM -0500, Aar Em wrote:
> Glist *headers;
> .....
>    headers = g_list_insert_sorted (headers, m,compare_ctime);

Do you initialize headers with NULL? If not, this could be the reason.
Otherwise, use gdb to see where it crashes.


> typedef struct _message_info
> {
>  char *from;
>  char *subject;
>  char *face;
>  long *ctime;
> } MESSAGE_INFO;
...
> static gint compare_ctime (gconstpointer a, gconstpointer b)
> {
>  const MESSAGE_INFO *p1=a,*p2=b;
>
> return ((p1->ctime > p2->ctime) ? +1: (p1->ctime == p2->ctime) ? 0 : -1);
> }

I don't know what long *ctime is, but sorting by pointer value looks
suspicious. This shouldn't segfault, but I'm not sure it does what you
want.


With kind regards,
Baurzhan.
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




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