mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-11-03 01:42:18 +01:00
gutils: Mark load_user_special_dirs unlocked
The load_user_special_dirs function performs no internal locking, which means that callers must already hold the g_utils_global lock. Since we mark some getters as unlocked by now, do the same with load_user_special_dirs to highlight this additional requirement. Suggested by Michael Catanzaro
This commit is contained in:
@@ -2217,7 +2217,7 @@ g_get_user_runtime_dir (void)
|
||||
void load_user_special_dirs_macos (gchar **table);
|
||||
|
||||
static void
|
||||
load_user_special_dirs (void)
|
||||
load_user_special_dirs_unlocked (void)
|
||||
{
|
||||
load_user_special_dirs_macos (g_user_special_dirs);
|
||||
}
|
||||
@@ -2225,7 +2225,7 @@ load_user_special_dirs (void)
|
||||
#elif defined(G_OS_WIN32)
|
||||
|
||||
static void
|
||||
load_user_special_dirs (void)
|
||||
load_user_special_dirs_unlocked (void)
|
||||
{
|
||||
g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = get_special_folder (&FOLDERID_Desktop);
|
||||
g_user_special_dirs[G_USER_DIRECTORY_DOCUMENTS] = get_special_folder (&FOLDERID_Documents);
|
||||
@@ -2274,7 +2274,7 @@ load_user_special_dirs (void)
|
||||
* SOFTWARE.
|
||||
*/
|
||||
static void
|
||||
load_user_special_dirs (void)
|
||||
load_user_special_dirs_unlocked (void)
|
||||
{
|
||||
const gchar *config_dir = NULL;
|
||||
const gchar *home_dir;
|
||||
@@ -2331,7 +2331,7 @@ g_reload_user_special_dirs_cache (void)
|
||||
|
||||
/* recreate and reload our cache */
|
||||
g_user_special_dirs = g_new0 (gchar *, G_USER_N_DIRECTORIES);
|
||||
load_user_special_dirs ();
|
||||
load_user_special_dirs_unlocked ();
|
||||
|
||||
/* only leak changed directories */
|
||||
for (i = 0; i < G_USER_N_DIRECTORIES; i++)
|
||||
@@ -2393,7 +2393,7 @@ g_get_user_special_dir (GUserDirectory directory)
|
||||
{
|
||||
g_user_special_dirs = g_new0 (gchar *, G_USER_N_DIRECTORIES);
|
||||
|
||||
load_user_special_dirs ();
|
||||
load_user_special_dirs_unlocked ();
|
||||
|
||||
/* Special-case desktop for historical compatibility */
|
||||
if (g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] == NULL)
|
||||
|
||||
@@ -187,7 +187,7 @@ test_cleanup_doesnt_follow_symlinks (void)
|
||||
}
|
||||
|
||||
static void
|
||||
test_load_user_special_dirs (void)
|
||||
test_load_user_special_dirs_unlocked (void)
|
||||
{
|
||||
#if defined(HAVE_COCOA) || defined(G_OS_WIN32)
|
||||
g_test_skip ("The user-dirs.dirs parser is not used on this platform.");
|
||||
@@ -255,7 +255,7 @@ main (int argc,
|
||||
|
||||
g_test_add_func ("/utils-isolated/tmp-dir", test_tmp_dir);
|
||||
g_test_add_func ("/utils-isolated/home-dir", test_home_dir);
|
||||
g_test_add_func ("/utils-isolated/load-user-special-dirs", test_load_user_special_dirs);
|
||||
g_test_add_func ("/utils-isolated/load-user-special-dirs-unlocked", test_load_user_special_dirs_unlocked);
|
||||
g_test_add_func ("/utils-isolated/user-cache-dir", test_user_cache_dir);
|
||||
g_test_add_func ("/utils-isolated/system-config-dirs", test_system_config_dirs);
|
||||
g_test_add_func ("/utils-isolated/user-config-dir", test_user_config_dir);
|
||||
|
||||
Reference in New Issue
Block a user