Merge branch 'wip/chergert/merge-private-fix' into 'glib-2-66'

gthread: Destroy value after replacing it in g_private_replace()

See merge request GNOME/glib!1820
This commit is contained in:
Sebastian Dröge 2020-12-17 18:43:24 +00:00
commit 4c6daefd6b
2 changed files with 4 additions and 3 deletions

View File

@ -1116,11 +1116,12 @@ g_private_replace (GPrivate *key,
gint status;
old = pthread_getspecific (*impl);
if (old && key->notify)
key->notify (old);
if G_UNLIKELY ((status = pthread_setspecific (*impl, value)) != 0)
g_thread_abort (status, "pthread_setspecific");
if (old && key->notify)
key->notify (old);
}
/* {{{1 GThread */

View File

@ -373,9 +373,9 @@ g_private_replace (GPrivate *key,
gpointer old;
old = TlsGetValue (impl);
TlsSetValue (impl, value);
if (old && key->notify)
key->notify (old);
TlsSetValue (impl, value);
}
/* {{{1 GThread */