[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-app-devel
Subject:    Re: simple GList question. Freeing data elements?
From:       Havoc Pennington <rhp () zirx ! pair ! com>
Date:       1999-07-11 15:19:25
[Download RAW message or body]


On Sun, 11 Jul 1999, Thomas Niederreiter wrote:
> 
> I do allocate memory for each structure and then append a pointer to it as data
> to a glist.
> 
> When I call g_list_free() do I have first free each data-element manually?
> So call g_free(mydata->data) for each element myself? Or does
> g_list_free free automatically each data pointer?
> 

You have to free it manually - C has no concept of destructors, so it
doesn't know if g_free or gtk_object_destroy or what is the correct way to
free your data structure. g_list_free() frees only the list nodes.

Havoc



-- 
         To unsubscribe: mail gtk-app-devel-list-request@redhat.com with 
                       "unsubscribe" as the Subject.

	Mailing list concerns should be mailed to <listmaster@redhat.com>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic