Merge branch '2210-private-replace-destroy' into 'master'

gthread: Destroy value after replacing it in g_private_replace()

Closes #2210

See merge request GNOME/glib!1667
This commit is contained in:
Philip Withnall 2020-10-01 13:43:52 +00:00
commit 06dabe05b1
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 */