From 9e0cfe66fdf08e697e1c58496c5bba20cc432a79 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 8 Apr 2024 14:01:56 +0900 Subject: [PATCH] Add mutex lock Change-Id: Ib374d339c90f7554adbfa247c4164192dcd16e44 std::map is not thread safe. --- src/utils_i18n_private.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils_i18n_private.cpp b/src/utils_i18n_private.cpp index 9ea0ef0..af6b9f5 100644 --- a/src/utils_i18n_private.cpp +++ b/src/utils_i18n_private.cpp @@ -16,12 +16,15 @@ #include #include +#include +static std::mutex mMutex; using namespace std; int _i18n_error_mapping(int err) { static map err_map; + const std::lock_guard lock(mMutex); if(err_map.empty()) { err_map.insert(make_pair(U_STRING_NOT_TERMINATED_WARNING, I18N_WARNING_STRING_NOT_TERMINATED)); -- 2.7.4