Add mutex lock 60/309260/2 accepted/tizen/8.0/unified/20240409.150657
authorDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 8 Apr 2024 05:01:56 +0000 (14:01 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 8 Apr 2024 07:38:28 +0000 (16:38 +0900)
Change-Id: Ib374d339c90f7554adbfa247c4164192dcd16e44
std::map is not thread safe.

src/utils_i18n_private.cpp

index 9ea0ef00aa63a1bfafc6fbdc10fe55545f2286ad..af6b9f5555e972b9f77bb020007be50bf1da36b7 100644 (file)
 
 #include <utils_i18n_private.h>
 #include <map>
+#include <mutex>
 
+static std::mutex mMutex;
 using namespace std;
 
 int _i18n_error_mapping(int err) {
 
        static map<int, int> err_map;
+       const std::lock_guard<std::mutex> lock(mMutex);
 
        if(err_map.empty()) {
                err_map.insert(make_pair(U_STRING_NOT_TERMINATED_WARNING, I18N_WARNING_STRING_NOT_TERMINATED));