diff --git a/hecl/blender/BlenderConnection.cpp b/hecl/blender/BlenderConnection.cpp index 8d3a9ed16..d5eb560e8 100644 --- a/hecl/blender/BlenderConnection.cpp +++ b/hecl/blender/BlenderConnection.cpp @@ -168,6 +168,10 @@ void BlenderConnection::_closePipe() { close(m_readpipe[0]); close(m_writepipe[1]); +#ifdef _WIN32 + CloseHandle(m_pinfo.hProcess); + CloseHandle(m_pinfo.hThread); +#endif } void BlenderConnection::_blenderDied() @@ -280,8 +284,7 @@ BlenderConnection::BlenderConnection(int verbosityLevel) sinfo.dwFlags = STARTF_USESTDHANDLES; } - PROCESS_INFORMATION pinfo; - if (!CreateProcessW(blenderBin, cmdLine, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, &sinfo, &pinfo)) + if (!CreateProcessW(blenderBin, cmdLine, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS, NULL, NULL, &sinfo, &m_pinfo)) { LPWSTR messageBuffer = nullptr; size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, diff --git a/hecl/blender/BlenderConnection.hpp b/hecl/blender/BlenderConnection.hpp index 5d62790f3..74c3deb01 100644 --- a/hecl/blender/BlenderConnection.hpp +++ b/hecl/blender/BlenderConnection.hpp @@ -51,9 +51,10 @@ public: private: bool m_lock = false; #if _WIN32 - HANDLE m_blenderProc; + HANDLE m_blenderProc = 0; + PROCESS_INFORMATION m_pinfo = {}; #else - pid_t m_blenderProc; + pid_t m_blenderProc = 0; #endif int m_readpipe[2]; int m_writepipe[2];