Re: How to detect if a glist->data is a GUINT_TO_POINTER for not freeing it ?



On Fri, 21 Apr 2006 12:11:48 +0200, Colossus <colossus 3000 it> wrote:

Hi Colossus,

I have to fill a GList with strings and unsigned long int.
The content of the GList is not always the same so I don't
know wich element is a string to free or a GUINT_TO_POINTER
don't use GUINT_TO_POINTER. Instead create manually a pointer to an
unsigned long int and allocate memory for it
unsigned long int *iptr = g_malloc(sizeof(unsigned long int));

give it some value
*iptr = 100l;

and fill the list with this value and freeing should work without
problems(but I haven't tested it).


regards,
Enrico

-- 
Get my GPG key from http://www.uvena.de/pub.key
Geany, a lightweight IDE using GTK2 - http://geany.uvena.de


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