From 762a54a388aca616c799c4a8542a89aae9450c45 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 12 Jan 2025 06:01:10 -0800 Subject: [PATCH] Core: Threads should not attempt to exit a thread that is already dead --- src/core/thread.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/thread.c b/src/core/thread.c index 988ce0848..92d134120 100644 --- a/src/core/thread.c +++ b/src/core/thread.c @@ -507,6 +507,10 @@ void mCoreThreadClearCrashed(struct mCoreThread* threadContext) { void mCoreThreadEnd(struct mCoreThread* threadContext) { MutexLock(&threadContext->impl->stateMutex); + if (threadContext->impl->state == mTHREAD_SHUTDOWN) { + MutexUnlock(&threadContext->impl->stateMutex); + return; + } _waitOnInterrupt(threadContext->impl); threadContext->impl->state = mTHREAD_EXITING; ConditionWake(&threadContext->impl->stateOnThreadCond);