File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -71,17 +71,19 @@ inline void setLogFile(FILE* file) {
7171inline void log (LogLevel level, const char * category, const char * format, ...) {
7272 if (level > g_log_level) return ;
7373
74- std::lock_guard<std::mutex> lock (g_log_mutex);
74+ #ifdef _WIN32
75+ // During early GUI startup on some Win10 systems, touching the shared
76+ // logging mutex/CRT stream path can crash. If no explicit file sink is set,
77+ // skip logging entirely.
7578 FILE* out = g_log_file;
7679 if (!out) {
77- #ifdef _WIN32
78- // GUI-subsystem processes can have an invalid stderr stream on Win10.
79- // Avoid using stderr entirely on Windows unless an explicit log file is set.
8080 return ;
81+ }
82+ std::lock_guard<std::mutex> lock (g_log_mutex);
8183#else
82- out = stderr;
84+ std::lock_guard<std::mutex> lock (g_log_mutex);
85+ FILE* out = g_log_file ? g_log_file : stderr;
8386#endif
84- }
8587
8688 // Get elapsed time in milliseconds
8789 auto now = std::chrono::steady_clock::now ();
You can’t perform that action at this time.
0 commit comments