From 61ca651fe191ccce6eaa74345ef8912908da005b Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 8 May 2023 20:34:28 -0700 Subject: [PATCH] FEXCore: Don't initialize ThunkHandler on Win32 Adds a couple pointer checks to ensure it won't crash. Doesn't work and will cause assertions. --- External/FEXCore/Source/Interface/Core/Core.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/External/FEXCore/Source/Interface/Core/Core.cpp b/External/FEXCore/Source/Interface/Core/Core.cpp index cb775307d..2ad175a5e 100644 --- a/External/FEXCore/Source/Interface/Core/Core.cpp +++ b/External/FEXCore/Source/Interface/Core/Core.cpp @@ -308,7 +308,9 @@ namespace FEXCore::Context { StopGdbServer(); } +#ifndef _WIN32 ThunkHandler = FEXCore::ThunkHandler::Create(); +#endif using namespace FEXCore::Core; @@ -556,7 +558,9 @@ namespace FEXCore::Context { Thread->ThreadManager.TID = FHU::Syscalls::gettid(); Thread->ThreadManager.PID = ::getpid(); SignalDelegation->RegisterTLSState(Thread); - ThunkHandler->RegisterTLSState(Thread); + if (ThunkHandler) { + ThunkHandler->RegisterTLSState(Thread); + } } void ContextImpl::RunThread(FEXCore::Core::InternalThreadState *Thread) { @@ -1361,7 +1365,9 @@ namespace FEXCore::Context { } void ContextImpl::AppendThunkDefinitions(fextl::vector const& Definitions) { - ThunkHandler->AppendThunkDefinitions(Definitions); + if (ThunkHandler) { + ThunkHandler->AppendThunkDefinitions(Definitions); + } } void ContextImpl::ConfigureAOTGen(FEXCore::Core::InternalThreadState *Thread, fextl::set *ExternalBranches, uint64_t SectionMaxAddress) {