gutils: Add a private API to unset the cached temporary directory

We may need to avoid using a cached temp directory for testing purposes,
so let's provide an internal API to perform such task.

This implies removing GOnce and going with mutex-based version, but
that's still using atomic logic in most unix implementations anyways.
This commit is contained in:
Marco Trevisan (Treviño)
2022-09-13 03:03:51 +02:00
parent ded3099afc
commit f520066563
3 changed files with 47 additions and 7 deletions

View File

@@ -840,6 +840,19 @@
fun:g_set_user_dirs
}
# _g_unset_cached_tmp_dir() deliberately leaks the previous cached g_get_tmp_dir() values.
# These will not all be reachable on exit.
{
g_get_tmp_dir
Memcheck:Leak
match-leak-kinds:definite,reachable
fun:malloc
...
fun:g_get_tmp_dir
...
fun:g_test_init
}
# g_get_system_data_dirs() caches a one-time allocation
{
g_get_system_data_dirs