fchash: Fix replace
When we replace a bucket in the hashtable we have to update the next pointer too, or we lose all the other elements that hashed to this key.
This commit is contained in:
parent
7ca28c2fed
commit
0b59a65a71
|
@ -182,6 +182,7 @@ FcHashTableAddInternal (FcHashTable *table,
|
||||||
{
|
{
|
||||||
if (replace)
|
if (replace)
|
||||||
{
|
{
|
||||||
|
bucket->next = b->next;
|
||||||
if (!fc_atomic_ptr_cmpexch (prev, b, bucket))
|
if (!fc_atomic_ptr_cmpexch (prev, b, bucket))
|
||||||
goto retry;
|
goto retry;
|
||||||
bucket = b;
|
bucket = b;
|
||||||
|
@ -191,6 +192,7 @@ FcHashTableAddInternal (FcHashTable *table,
|
||||||
goto destroy;
|
goto destroy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bucket->next = NULL;
|
||||||
if (!fc_atomic_ptr_cmpexch (prev, b, bucket))
|
if (!fc_atomic_ptr_cmpexch (prev, b, bucket))
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue