diff --git a/frameworks/native/appkit/ability_runtime/context/context_impl.cpp b/frameworks/native/appkit/ability_runtime/context/context_impl.cpp index ab251af42f..4c0d48a45d 100644 --- a/frameworks/native/appkit/ability_runtime/context/context_impl.cpp +++ b/frameworks/native/appkit/ability_runtime/context/context_impl.cpp @@ -955,6 +955,7 @@ void ContextImpl::SubscribeToOverlayEvents(std::shared_ptr overlayModuleInfos) { + std::lock_guard lock(overlaySubscriberMutex_); if (overlaySubscriber_ != nullptr) { return; } @@ -976,6 +977,7 @@ void ContextImpl::SubscribeToOverlayEvents(std::shared_ptr lock(overlaySubscriberMutex_); if (overlaySubscriber_ != nullptr) { EventFwk::CommonEventManager::UnSubscribeCommonEvent(overlaySubscriber_); overlaySubscriber_ = nullptr; diff --git a/interfaces/kits/native/appkit/ability_runtime/context/context_impl.h b/interfaces/kits/native/appkit/ability_runtime/context/context_impl.h index 04f073e077..553325ff73 100644 --- a/interfaces/kits/native/appkit/ability_runtime/context/context_impl.h +++ b/interfaces/kits/native/appkit/ability_runtime/context/context_impl.h @@ -495,6 +495,7 @@ private: // False: no need to get a new fms remote object. volatile bool resetFlag_ = false; + std::mutex overlaySubscriberMutex_; std::shared_ptr overlaySubscriber_; }; } // namespace AbilityRuntime diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index cae45eb55a..a78fe7ec25 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -8120,6 +8120,10 @@ bool AppMgrServiceInner::IsProcessContainsOnlyUIAbility(const pid_t pid) void AppMgrServiceInner::MakeIsolateSandBoxProcessName(const std::shared_ptr &abilityInfo, const HapModuleInfo &hapModuleInfo, std::string &processName) const { + if (abilityInfo == nullptr) { + TAG_LOGE(AAFwkTag::APPMGR, "abilityInfo nullptr"); + return; + } auto type = abilityInfo->type; auto extensionType = abilityInfo->extensionAbilityType; if (type != AppExecFwk::AbilityType::EXTENSION || @@ -8127,9 +8131,12 @@ void AppMgrServiceInner::MakeIsolateSandBoxProcessName(const std::shared_ptrname && extensionInfo.needCreateSandbox) { - processName = (processName + ":" + abilityInfo->name); + for (const auto& extensionInfo: hapModuleInfo.extensionInfos) { + if (extensionInfo.name == abilityInfo->name) { + if (extensionInfo.needCreateSandbox) { + processName = (processName + ":" + abilityInfo->name); + } + return; } } }