diff options
author | Ryan Lortie <desrt@desrt.ca> | 2012-07-06 14:06:04 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2012-07-06 14:06:04 -0400 |
commit | fb6ad83ace3aa4c7fb912b202754161ae8c1da65 (patch) | |
tree | d9dd8c8033f545bb2311584804f543644d2241d3 | |
parent | 1304b14a44486d1231ff92fdbed39a60d0919582 (diff) | |
download | dconf-fb6ad83ace3aa4c7fb912b202754161ae8c1da65.tar.gz |
user source: use threadsafe init for shmdir
Otherwise it's possible for multiple threads to initialise it at the
same time.
Each thread will come up with the same value anyway, but it's a string,
so we will leak all but one of them.
-rw-r--r-- | engine/dconf-engine-source-user.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/engine/dconf-engine-source-user.c b/engine/dconf-engine-source-user.c index dba655f..7c44b79 100644 --- a/engine/dconf-engine-source-user.c +++ b/engine/dconf-engine-source-user.c @@ -41,8 +41,8 @@ dconf_engine_source_user_open_shm (const gchar *name) void *memory; gint fd; - if (shmdir == NULL) - shmdir = g_build_filename (g_get_user_runtime_dir (), "dconf", NULL); + if (g_once_init_enter (&shmdir)) + g_once_init_leave (&shmdir, g_build_filename (g_get_user_runtime_dir (), "dconf", NULL)); filename = g_build_filename (shmdir, name, NULL); memory = NULL; |