diff --git a/src/util/util_env.cpp b/src/util/util_env.cpp index 7644e07fa..df0587b7e 100644 --- a/src/util/util_env.cpp +++ b/src/util/util_env.cpp @@ -36,13 +36,8 @@ namespace dxvk::env { void setThreadName(const std::string& name) { using SetThreadDescriptionProc = HRESULT (WINAPI *) (HANDLE, PCWSTR); - HMODULE module = ::GetModuleHandleW(L"kernel32.dll"); - - if (module == nullptr) - return; - - auto proc = reinterpret_cast( - ::GetProcAddress(module, "SetThreadDescription")); + static auto proc = reinterpret_cast( + ::GetProcAddress(::GetModuleHandleW(L"kernel32.dll"), "SetThreadDescription")); if (proc != nullptr) { auto wideName = str::tows(name);