--- src/util/non_replacing_hash_table.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/src/util/non_replacing_hash_table.c b/src/util/non_replacing_hash_table.c index a4c57e9349..33c93452c4 100644 --- a/src/util/non_replacing_hash_table.c +++ b/src/util/non_replacing_hash_table.c @@ -183,6 +183,7 @@ _mesa_hash_table_clear(struct hash_table *ht, delete_function(entry); entry->key = NULL; + entry->next_data = 0; } ht->entries = 0; @@ -413,6 +414,10 @@ _mesa_hash_table_insert_pre_hashed(struct hash_table *ht, uint32_t hash, * * Note that deletion doesn't otherwise modify the table, so an iteration over * the table deleting entries is safe. + * + * IMPORTANT: The table only allows deleting the last entry of a chain of + * entries with matching keys. If an entry in the middle of the chain is deleted + * the chain will be broken, and the table will have unpredictable results. */ void _mesa_hash_table_remove(struct hash_table *ht, @@ -424,6 +429,7 @@ _mesa_hash_table_remove(struct hash_table *ht, entry->key = ht->deleted_key; ht->entries--; ht->deleted_entries++; + entry->next_data = 0; } /** -- 2.11.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev