File: gutils-Mark-load_user_special_dirs-unlocked.patch

package info (click to toggle)
glib2.0 2.86.0-6
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 74,852 kB
  • sloc: ansic: 544,570; python: 9,702; sh: 1,612; xml: 1,482; perl: 1,222; cpp: 535; makefile: 321; javascript: 11
file content (88 lines) | stat: -rw-r--r-- 3,357 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
From: Tobias Stoeckmann <tobias@stoeckmann.org>
Date: Tue, 16 Sep 2025 19:17:13 +0200
Subject: 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

Origin: upstream, 2.86.1, commit:3d7caa9407d5627b00e76f6511cdfa3cd058476c
---
 glib/gutils.c               | 10 +++++-----
 glib/tests/utils-isolated.c |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/glib/gutils.c b/glib/gutils.c
index 26f22d8..2704636 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -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)
diff --git a/glib/tests/utils-isolated.c b/glib/tests/utils-isolated.c
index d376121..fa14076 100644
--- a/glib/tests/utils-isolated.c
+++ b/glib/tests/utils-isolated.c
@@ -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);