mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 01:03:08 +00:00
!48240 [Bug]: 修复卡片多线程设置语言踩内存问题
Merge pull request !48240 from llzr/lzr62
This commit is contained in:
commit
39380429d0
@ -60,6 +60,7 @@ void AceApplicationInfoImpl::ChangeLocale(const std::string& language, const std
|
||||
void AceApplicationInfoImpl::SetLocale(const std::string& language, const std::string& countryOrRegion,
|
||||
const std::string& script, const std::string& keywordsAndValues)
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> lock(localeTagMutex_);
|
||||
language_ = language;
|
||||
countryOrRegion_ = countryOrRegion;
|
||||
script_ = script;
|
||||
|
@ -18,15 +18,18 @@
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
#include <shared_mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "interfaces/inner_api/ace/ace_forward_compatibility.h"
|
||||
|
||||
#include "base/json/json_util.h"
|
||||
#include "base/utils/macros.h"
|
||||
#include "base/utils/noncopyable.h"
|
||||
#include "base/utils/string_utils.h"
|
||||
#include "interfaces/inner_api/ace/ace_forward_compatibility.h"
|
||||
|
||||
namespace OHOS::Ace {
|
||||
|
||||
@ -145,6 +148,7 @@ public:
|
||||
|
||||
const std::string& GetLocaleTag() const
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock(localeTagMutex_);
|
||||
return localeTag_;
|
||||
}
|
||||
|
||||
@ -228,6 +232,7 @@ protected:
|
||||
std::string language_;
|
||||
std::string script_;
|
||||
std::string localeTag_;
|
||||
mutable std::shared_mutex localeTagMutex_;
|
||||
std::string keywordsAndValues_;
|
||||
|
||||
std::string packageName_;
|
||||
|
Loading…
Reference in New Issue
Block a user