diff options
author | Thomas Haller <thaller@redhat.com> | 2021-08-05 08:38:07 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-08-10 19:15:07 +0200 |
commit | c37f72acd314c707bdf6912f47e0fbdd4c6b3969 (patch) | |
tree | f5324a3351c64aeecbf7d552ac19827e0e27c908 | |
parent | ef3b773bc360885f8dfe6389c49397afd0162b0f (diff) | |
download | NetworkManager-c37f72acd314c707bdf6912f47e0fbdd4c6b3969.tar.gz |
glib-aux: fix thread-safe initialization in _nm_g_source_sentinel_get_init()
Fixes: ce7c28c514c8 ('glib-aux: add nm_g_source_sentinel_get() util')
(cherry picked from commit 2140bbf7f52429a34993ed98098b2afb5443c676)
-rw-r--r-- | src/libnm-glib-aux/nm-shared-utils.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libnm-glib-aux/nm-shared-utils.c b/src/libnm-glib-aux/nm-shared-utils.c index fac4319692..81852aea36 100644 --- a/src/libnm-glib-aux/nm-shared-utils.c +++ b/src/libnm-glib-aux/nm-shared-utils.c @@ -4935,14 +4935,14 @@ _nm_g_source_sentinel_get_init(GSource **p_source) }; GSource *source; -again: source = g_source_new((GSourceFuncs *) &source_funcs, sizeof(GSource)); g_source_set_priority(source, G_PRIORITY_DEFAULT_IDLE); g_source_set_name(source, "nm_g_source_sentinel"); if (!g_atomic_pointer_compare_and_exchange(p_source, NULL, source)) { g_source_unref(source); - goto again; + source = g_atomic_pointer_get(p_source); + nm_assert(source); } return source; |