• Allison Karlitskaya's avatar
    GVariantTypeInfo: fix thread safety bug · a3c7406c
    Allison Karlitskaya authored
    Issue caught by Michael Meeks.  This patch based on his.
    GVariantTypeInfo was dropping the reference count on the TypeInfo
    structure before removing it from the hash table.  This means that
    another thread could come along and grab the value from the hash table
    in the meantime.
    Solve this by holding the lock on the table before dropping the
    Also: move the hash table initialisation inside of the lock to remove
    the standard double-initialisation race plus a more insidious issue
    caused by the fact that we free the hash table once it becomes empty.
gvarianttypeinfo.c 27.2 KB