Fix dumb bug in HashTable::clear().
We forgot to clear the m_buckets pointer. This meant that multiple calls to clear() would cause trouble.
This commit is contained in:
parent
2b4374d08e
commit
3a4207b863
Notes:
sideshowbarker
2024-07-19 15:55:10 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3a4207b8639
2 changed files with 4 additions and 4 deletions
|
@ -301,7 +301,10 @@ void HashTable<T, TraitsForT>::rehash(unsigned new_capacity)
|
|||
template<typename T, typename TraitsForT>
|
||||
void HashTable<T, TraitsForT>::clear()
|
||||
{
|
||||
if (m_buckets) {
|
||||
delete [] m_buckets;
|
||||
m_buckets = nullptr;
|
||||
}
|
||||
m_capacity = 0;
|
||||
m_size = 0;
|
||||
}
|
||||
|
|
|
@ -373,9 +373,6 @@ void Ext2FSInode::flush_metadata()
|
|||
// Unless we're about to go away permanently, invalidate the lookup cache.
|
||||
if (m_raw_inode.i_links_count != 0) {
|
||||
LOCKER(m_lock);
|
||||
// FIXME: Something isn't working right when we hit this code path.
|
||||
// I've seen crashes inside HashMap::clear() all the way down in DoublyLinkedList::clear().
|
||||
// My guess would be a HashTable bug.
|
||||
// FIXME: This invalidation is way too hardcore. It's sad to throw away the whole cache.
|
||||
m_lookup_cache.clear();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue