Fix assertion on thread double-free from registry (not harmful)

This commit is contained in:
Wojciech Figat
2022-12-29 11:20:39 +01:00
committed by Wojtek Figat
parent f8e3f2fdc0
commit 6ef49349ff

View File

@@ -47,7 +47,6 @@ void ThreadRegistry::KillEmAll()
void ThreadRegistry::Add(Thread* thread)
{
ASSERT(thread && thread->GetID() != 0);
Locker.Lock();
ASSERT(!Registry.ContainsKey(thread->GetID()) && !Registry.ContainsValue(thread));
Registry.Add(thread->GetID(), thread);
@@ -57,9 +56,11 @@ void ThreadRegistry::Add(Thread* thread)
void ThreadRegistry::Remove(Thread* thread)
{
ASSERT(thread && thread->GetID() != 0);
Locker.Lock();
ASSERT_LOW_LAYER(Registry.ContainsKey(thread->GetID()) && Registry[thread->GetID()] == thread);
#if ENABLE_ASSERTION_LOW_LAYERS
Thread** currentValue = Registry.TryGet(thread->GetID());
ASSERT_LOW_LAYER(!currentValue || *currentValue == thread);
#endif
Registry.Remove(thread->GetID());
Locker.Unlock();
}