mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-05 00:46:16 +01:00
Don't deadlock when running with threads. (#444121, Christian Persch)
2007-06-05 Matthias Clasen <mclasen@redhat.com> * glib/gutils.c (g_get_user_special_dir): Don't deadlock when running with threads. (#444121, Christian Persch) svn path=/trunk/; revision=5535
This commit is contained in:
parent
cc4b0a5452
commit
bcc342b81b
@ -1,3 +1,8 @@
|
||||
2007-06-05 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/gutils.c (g_get_user_special_dir): Don't deadlock
|
||||
when running with threads. (#444121, Christian Persch)
|
||||
|
||||
2007-06-05 Vincent Untz <vuntz@gnome.org>
|
||||
|
||||
* glib/goption.c: (g_option_context_get_help): don't replace the usage
|
||||
|
@ -2008,27 +2008,11 @@ g_get_user_data_dir (void)
|
||||
return data_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_get_user_config_dir:
|
||||
*
|
||||
* Returns a base directory in which to store user-specific application
|
||||
* configuration information such as user preferences and settings.
|
||||
*
|
||||
* On UNIX platforms this is determined using the mechanisms described in
|
||||
* the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
|
||||
* XDG Base Directory Specification</ulink>
|
||||
*
|
||||
* Return value: a string owned by GLib that must not be modified
|
||||
* or freed.
|
||||
* Since: 2.6
|
||||
**/
|
||||
G_CONST_RETURN gchar*
|
||||
g_get_user_config_dir (void)
|
||||
static void
|
||||
g_init_user_config_dir (void)
|
||||
{
|
||||
gchar *config_dir;
|
||||
|
||||
G_LOCK (g_utils_global);
|
||||
|
||||
if (!g_user_config_dir)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
@ -2048,14 +2032,35 @@ g_get_user_config_dir (void)
|
||||
else
|
||||
config_dir = g_build_filename (g_tmp_dir, g_user_name, ".config", NULL);
|
||||
}
|
||||
|
||||
g_user_config_dir = config_dir;
|
||||
}
|
||||
else
|
||||
config_dir = g_user_config_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_get_user_config_dir:
|
||||
*
|
||||
* Returns a base directory in which to store user-specific application
|
||||
* configuration information such as user preferences and settings.
|
||||
*
|
||||
* On UNIX platforms this is determined using the mechanisms described in
|
||||
* the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
|
||||
* XDG Base Directory Specification</ulink>
|
||||
*
|
||||
* Return value: a string owned by GLib that must not be modified
|
||||
* or freed.
|
||||
* Since: 2.6
|
||||
**/
|
||||
G_CONST_RETURN gchar*
|
||||
g_get_user_config_dir (void)
|
||||
{
|
||||
G_LOCK (g_utils_global);
|
||||
|
||||
g_init_user_config_dir ();
|
||||
|
||||
G_UNLOCK (g_utils_global);
|
||||
|
||||
return config_dir;
|
||||
return g_user_config_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2221,7 +2226,7 @@ maybe_expire_user_special_dirs (void)
|
||||
|
||||
g_user_special_dirs_stat_time = now;
|
||||
|
||||
config_file = g_build_filename (g_get_user_config_dir (),
|
||||
config_file = g_build_filename (g_user_config_dir,
|
||||
"user-dirs.dirs",
|
||||
NULL);
|
||||
|
||||
@ -2246,6 +2251,9 @@ out:
|
||||
g_free (config_file);
|
||||
}
|
||||
|
||||
|
||||
static void g_init_user_config_dir (void);
|
||||
|
||||
/* adapted from xdg-user-dir-lookup.c
|
||||
*
|
||||
* Copyright (C) 2007 Red Hat Inc.
|
||||
@ -2278,7 +2286,8 @@ load_user_special_dirs (void)
|
||||
gchar **lines;
|
||||
gint n_lines, i;
|
||||
|
||||
config_file = g_build_filename (g_get_user_config_dir (),
|
||||
g_init_user_config_dir ();
|
||||
config_file = g_build_filename (g_user_config_dir,
|
||||
"user-dirs.dirs",
|
||||
NULL);
|
||||
|
||||
@ -2387,7 +2396,10 @@ load_user_special_dirs (void)
|
||||
d[len - 1] = 0;
|
||||
|
||||
if (is_relative)
|
||||
g_user_special_dirs[directory] = g_build_filename (g_get_home_dir (), d, NULL);
|
||||
{
|
||||
g_get_any_init ();
|
||||
g_user_special_dirs[directory] = g_build_filename (g_home_dir, d, NULL);
|
||||
}
|
||||
else
|
||||
g_user_special_dirs[directory] = g_strdup (d);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user