From 3c30f7b97147180709e738f006fd93fab0b3b2b7 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Thu, 11 Mar 2021 01:42:23 +0100 Subject: [PATCH] Fix crash when creating threads with Thread_AutoRelease Setting the Thread_AutoRelease flag (default when using IThreader::MakeThread) caused a use-after-free after running the thread body. --- core/logic/ThreadSupport.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/core/logic/ThreadSupport.cpp b/core/logic/ThreadSupport.cpp index e2bbdbee..315afb5c 100644 --- a/core/logic/ThreadSupport.cpp +++ b/core/logic/ThreadSupport.cpp @@ -376,6 +376,7 @@ void CompatThread::Run() // There should be no handles outstanding, so it's safe to self-destruct. thread_->detach(); delete this; + return; } lock.lock();