Fix crash on thread end that used Mono runtime

This commit is contained in:
Wojciech Figat
2021-11-23 17:26:05 +01:00
parent 136b1fc421
commit 4322563eed
2 changed files with 6 additions and 12 deletions

View File

@@ -4,6 +4,7 @@
#include "Engine/Threading/IRunnable.h"
#include "Engine/Threading/ThreadRegistry.h"
#include "Engine/Core/Log.h"
#include "Engine/Scripting/ManagedCLR/MCore.h"
#if TRACY_ENABLE
#include "Engine/Core/Math/Math.h"
#include <ThirdParty/tracy/Tracy.h>
@@ -108,6 +109,8 @@ int32 ThreadBase::Run()
_isRunning = false;
ThreadExiting(thread, exitCode);
ThreadRegistry::Remove(thread);
MCore::ExitThread(); // TODO: use mono_thread_detach instead of ext and unlink mono runtime from thread in ThreadExiting delegate
// mono terminates the native thread..
return exitCode;
}