diff options
author | Tor Lillqvist <tml@src.gnome.org> | 2000-02-03 01:42:51 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2000-02-03 01:42:51 +0000 |
commit | a30c4b9e94943b2fa70e38be197529f84fbe6ad5 (patch) | |
tree | a540659be70ac66f588ffe7b94cc1b60e6e581e3 /gtk/gtkfilesel.h | |
parent | e57b1afa2b4c91bcfecef26e4bff5280bd3563de (diff) | |
download | gtk+-a30c4b9e94943b2fa70e38be197529f84fbe6ad5.tar.gz |
Argh, decided not to return a string that must be freed from
gtk_file_selection_get_filename after all, as that would
cause memory leaks in all apps that use it unless they
specifically checked fot the GTk+ version.
gtk_file_selection_get_filename returns the filename in the C
runtime encoding. It calls g_filename_from_utf8, but copies the
returned string to a static buffer, which is returned. I think
this is better than returning the result from g_filename_from_utf8
directly, which would mean all apps that use it would have to free
the return value. Or should this function care about this issue at
all? Maybe a new function with clearly defined semantics.
Diffstat (limited to 'gtk/gtkfilesel.h')
-rw-r--r-- | gtk/gtkfilesel.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gtk/gtkfilesel.h b/gtk/gtkfilesel.h index 24ff5de521..d5970c3f1a 100644 --- a/gtk/gtkfilesel.h +++ b/gtk/gtkfilesel.h @@ -89,7 +89,8 @@ void gtk_file_selection_set_filename (GtkFileSelection *filesel, /* This function returns the selected filename in the C runtime's * multibyte string encoding, which may or may not be the same as that * used by GDK (UTF-8). To convert to UTF-8, call g_filename_to_utf8(). - * The returned string should be deallocated with g_free(). + * The returned string points to a statically allocated buffer and + * should be copied away. */ gchar* gtk_file_selection_get_filename (GtkFileSelection *filesel); |