From 76be5eb9415d36f6250aba31b75541336ce25235 Mon Sep 17 00:00:00 2001 From: dreamforceinc Date: Thu, 7 Dec 2023 19:54:34 +0300 Subject: [PATCH] Moved function to inner scope. --- wCenterWindow/CLogger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wCenterWindow/CLogger.cpp b/wCenterWindow/CLogger.cpp index 76354ce..4b140c2 100644 --- a/wCenterWindow/CLogger.cpp +++ b/wCenterWindow/CLogger.cpp @@ -46,7 +46,6 @@ void CLogger::Out(const wchar_t* fmt, ...) { } void CLogger::Init() { - InitializeCriticalSection(&cs); wchar_t szPath[MAX_PATH] = { 0 }; DWORD dwPathLength = GetModuleFileNameW(NULL, szPath, MAX_PATH); DWORD dwError = GetLastError(); @@ -70,6 +69,7 @@ void CLogger::Init() { #endif fsLogFile.open(log_path, std::ios::trunc); if (fsLogFile.is_open()) { + InitializeCriticalSection(&cs); fsLogFile << "\xEF\xBB\xBF"; // (0xEF, 0xBB, 0xBF) - UTF-8 BOM fsLogFile.imbue(std::locale("en-US.utf8")); fsLogFile << GetTimeStamp() << "[ " << szAppTitleVer.c_str() << " ] Start log." << std::endl;