tests: Fix thread state cleanup in EGL_dummy.

When freeing a DummyThreadState struct, remove it from the linked list
first.
This commit is contained in:
Kyle Brenneman 2021-10-11 11:32:52 -06:00
parent 5024e5796e
commit 47063a7fb7
1 changed files with 13 additions and 2 deletions

View File

@ -112,9 +112,20 @@ static DummyThreadState *GetThreadState(void)
return thr;
}
void DestroyThreadState(DummyThreadState *thr)
{
if (thr != NULL)
{
__glvndPthreadFuncs.mutex_lock(&threadStateLock);
glvnd_list_del(&thr->entry);
__glvndPthreadFuncs.mutex_unlock(&threadStateLock);
free(thr);
}
}
static void OnThreadTerminate(void *ptr)
{
free(ptr);
DestroyThreadState((DummyThreadState *) ptr);
}
static void CommonEntrypoint(void)
@ -504,7 +515,7 @@ static EGLBoolean EGLAPIENTRY dummy_eglReleaseThread(void)
__glvndPthreadFuncs.getspecific(threadStateKey);
if (thr != NULL) {
__glvndPthreadFuncs.setspecific(threadStateKey, NULL);
free(thr);
DestroyThreadState(thr);
}
return EGL_TRUE;
}