Re: GSList and g_filename_from_uri free memory problem



David Necas (Yeti) wrote:

Since the problem seems to be an incorrect assumption of how
GSList works and I cannot describe how it actually works more
clearly than above, then either by letting someone with
better English skills to explain it or by you trying harder
to understand me.

Ok, I understood the matter. Let me explain my problem now:
I'm adding drag and drop to my app. To retrieve the content
of the selection dropped into the window of my app I use

gtk_selection_data_get_uris. The problem is that I get the filename
like this: file:///home/gt/GTA%20 and so on. So I use g_filename_from_uri to convert the filename but this function allocates memory that I must free. Since the user can drag and drop more than one file ( you noticed the while loop in the code ? ) when later I issue g_free ( filename ) only the last pointer will be freed and the others ?
--
Colossus
Xarchiver, a Linux GTK+2 only archive manager - http://xarchiver.sourceforge.net
Cpsed, a Linux OpenGL 3D scene editor - http://cpsed.sourceforge.net
Mizio, a QT proxy hunter scanner tool - http://mizio.sourceforge.net



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