Rework the way GStaticPrivate data is freed
To avoid iterating threads in g_static_private_free(), defer freeing
the per-thread data to thread exit. The one complication here is
that it is possible for the static private index to be reused while
'old' data is still around. To deal with that case, store the 'owner'
with each per-thread data node, and free old data in
g_static_private_get() if the owner doesn't match. The remaining
possibility that a private index could be reused by a GStaticPrivate
with the same address is sufficiently unlikely that we can probably
ignore it.
With this change, per-thread data is now truly private again,
and we can drop the lock for it as well.
https://bugzilla.gnome.org/show_bug.cgi?id=660635