Re: GSList and g_filename_from_uri free memory problem



Hi again,

The list is only valid if all filenames are not free'd!
As long as you work with the list do not free the filenames.
When you are done with the list, iterate over the list, free all filenames and then the list. something like this (untested):

GSLIst *list,*node
for(node=list;node;node=g_slist_next(node)) {
  g_free(node->data);
}
g_slist_free(list);

Stefan

Colossus wrote:
Stefan Kost wrote:

just don't fre the filenames now. Free the filenames when you free the list.


Ok, but you see the while loop ? if the user drags 10 files from Nautilis window inside Xarchiver ( my app ) window, when I issue g_free later I will only free the last pointer gave me back from
g_filename_from_uri and what the others nine ones ?





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