Re: GList strange behavior

2012-08-16 Thread Tadej Borovšak
Hi. Not sure what is troubling you here. GList is represented by pointer to first element or NULL if list is empty. And when you append items to the list, the address of the list stays the same, since first element of the list is unchanged (exception to this is when append first element to an

Re: GList strange behavior

2012-08-16 Thread Vlasov Vitaly
Thank you! I almost understand bahavior of GList. I need to save newly created list poiner. So, i need to use g_list_last() to save it? Is there another method to save created list pointer? В сообщении от Четверг 16 августа 2012 15:51:22 вы написали: Hi. Not sure what is troubling you here.

Re: GList strange behavior

2012-08-16 Thread David Nečas
On Thu, Aug 16, 2012 at 06:49:25PM +0400, Vlasov Vitaly wrote: I need to save newly created list poiner. No. Many operations change the list head (by adding, removing, reordering, ..., elements). In general, if an operation returns the new list head you *must* save and use that in subsequent

Re: GList strange behavior

2012-08-16 Thread Ardhan Madras
Hi, Seem you did not read my reply clearly. I told you the behaviour of g_list_append() and g_list_last() there. Okay, so your question is ( So, why g_list_append() dont' return me newly created list??? If you pass NULL pointer to first arg of g_list_append() it will returns a newly created

Re: GList strange behavior

2012-08-15 Thread Vlasov Vitaly
Hello Thanks for answer. Did you mean Last list element: 0x832c610 is differ from INIT list prt: 0x830f080? No. Lest's see... i got function do_work with: 1. new Glist init with random data 2. callback definition of button click: button_click(, GList *list) let

GList strange behavior

2012-08-14 Thread Vlasov Vitaly
Hi, list. I can't understand, why g_list_append return different values in my callback's(please read source). In first case i got same list, which was obtained from arguments. In second case g_list_append returns newly created list. Why result's is are not the same? In real program, i

Re: GList strange behavior

2012-08-14 Thread Ardhan Madras
Hi, In button_cb()... Did you mean Last list element: 0x832c610 is differ from INIT list prt: 0x830f080? It's clear because 0x830f080 was the location of first list and 0x832c610 is the last appended list. g_list_prepend() return to the start of the list, g_list_last() return the last of the