From 85c43cd666443935f6a18ecace8783d42ec528ce Mon Sep 17 00:00:00 2001 From: jp9000 Date: Tue, 24 Jan 2017 12:49:47 -0800 Subject: [PATCH] UI: Protect debug text static string var with mutex --- UI/obs-app.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index 607b86a17..5b2d38080 100644 --- a/UI/obs-app.cpp +++ b/UI/obs-app.cpp @@ -318,9 +318,12 @@ static void do_log(int log_level, const char *msg, va_list args, void *param) #ifdef _WIN32 if (IsDebuggerPresent()) { - static wstring wide_buf; int wNum = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); if (wNum > 1) { + static wstring wide_buf; + static mutex wide_mutex; + + lock_guard lock(wide_mutex); wide_buf.reserve(wNum + 1); wide_buf.resize(wNum - 1); MultiByteToWideChar(CP_UTF8, 0, str, -1, &wide_buf[0],