From 7eae43962495b33eb0bb6edaeccf6d51c7205580 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Sun, 4 Dec 2022 18:09:07 +0200 Subject: [PATCH] Fix RunProcess not working in development builds Works around a possible compiler bug caused by db6aab1cf6142be4bcfc872a99f381af9986508a --- Source/Engine/Platform/Windows/WindowsPlatform.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/Engine/Platform/Windows/WindowsPlatform.cpp b/Source/Engine/Platform/Windows/WindowsPlatform.cpp index 1e4337016..6cec9376a 100644 --- a/Source/Engine/Platform/Windows/WindowsPlatform.cpp +++ b/Source/Engine/Platform/Windows/WindowsPlatform.cpp @@ -1079,7 +1079,6 @@ int32 WindowsPlatform::RunProcess(const StringView& cmdLine, const StringView& w HANDLE stdOutRead = nullptr; HANDLE stdErrRead = nullptr; - Array attributeList; if (captureStdOut) { @@ -1101,8 +1100,7 @@ int32 WindowsPlatform::RunProcess(const StringView& cmdLine, const StringView& w SIZE_T bufferSize = 0; if (!InitializeProcThreadAttributeList(nullptr, 1, 0, &bufferSize) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - attributeList.Resize((int32)bufferSize); - startupInfoEx.lpAttributeList = (LPPROC_THREAD_ATTRIBUTE_LIST)attributeList.Get(); + startupInfoEx.lpAttributeList = (LPPROC_THREAD_ATTRIBUTE_LIST)Allocate(sizeof(byte) * bufferSize, 16); if (!InitializeProcThreadAttributeList(startupInfoEx.lpAttributeList, 1, 0, &bufferSize)) { LOG(Warning, "InitializeProcThreadAttributeList failed"); @@ -1176,6 +1174,7 @@ ERROR_EXIT: if (startupInfoEx.lpAttributeList != nullptr) { DeleteProcThreadAttributeList(startupInfoEx.lpAttributeList); + Allocator::Free(startupInfoEx.lpAttributeList); } return result;