Revision: 1093
http://geeqie.svn.sourceforge.net/geeqie/?rev=1093&view=rev
Author: bruclik
Date: 2008-08-26 20:21:30 +0000 (Tue, 26 Aug 2008)
Log Message:
-----------
Fixed segfault when is run inside directory with non valid uft-8 image
filename.
Modified Paths:
--------------
trunk/src/filedata.c
trunk/src/ui_fileops.c
Modified: trunk/src/filedata.c
===================================================================
--- trunk/src/filedata.c 2008-08-26 13:56:56 UTC (rev 1092)
+++ trunk/src/filedata.c 2008-08-26 20:21:30 UTC (rev 1093)
@@ -149,22 +149,22 @@
static void file_data_set_collate_keys(FileData *fd)
{
gchar *caseless_name;
+ gchar *name = path_to_utf8(fd->name);
+
+ caseless_name = g_utf8_casefold(name, -1);
- g_assert(g_utf8_validate(fd->name, -1, NULL));
-
- caseless_name = g_utf8_casefold(fd->name, -1);
-
g_free(fd->collate_key_name);
g_free(fd->collate_key_name_nocase);
#if GLIB_CHECK_VERSION(2, 8, 0)
- fd->collate_key_name = g_utf8_collate_key_for_filename(fd->name, -1);
+ fd->collate_key_name = g_utf8_collate_key_for_filename(name, -1);
fd->collate_key_name_nocase =
g_utf8_collate_key_for_filename(caseless_name, -1);
#else
- fd->collate_key_name = g_utf8_collate_key(fd->name, -1);
+ fd->collate_key_name = g_utf8_collate_key(name, -1);
fd->collate_key_name_nocase = g_utf8_collate_key(caseless_name, -1);
#endif
g_free(caseless_name);
+ g_free(name);
}
static void file_data_set_path(FileData *fd, const gchar *path)
Modified: trunk/src/ui_fileops.c
===================================================================
--- trunk/src/ui_fileops.c 2008-08-26 13:56:56 UTC (rev 1092)
+++ trunk/src/ui_fileops.c 2008-08-26 20:21:30 UTC (rev 1093)
@@ -172,20 +172,16 @@
return path;
}
-/* first we try the HOME environment var, if that doesn't work, we try
getpwuid(). */
+/* first we try the HOME environment var, if that doesn't work, we try
g_get_homedir(). */
const gchar *homedir(void)
{
static gchar *home = NULL;
if (!home)
- {
home = path_to_utf8(getenv("HOME"));
- }
+
if (!home)
- {
- struct passwd *pw = getpwuid(getuid());
- if (pw) home = path_to_utf8(pw->pw_dir);
- }
+ home = path_to_utf8(g_get_home_dir());
return home;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn