Merge pull request !11167 from zwt/issue_fix
This commit is contained in:
openharmony_ci 2024-10-26 09:36:04 +00:00 committed by Gitee
commit 166bc48b09
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 16 additions and 14 deletions

View File

@ -79,19 +79,21 @@ void ApplicationCleaner::ClearTempData()
TAG_LOGE(AAFwkTag::APPKIT, "Get root dir error");
return;
}
auto cleanTemp = [self = shared_from_this(), rootDir]() {
if (self == nullptr || self->context_ == nullptr) {
auto weakThis = weak_from_this();
auto cleanTemp = [weakThis, rootDir]() {
auto sharedThis = weakThis.lock();
if (sharedThis == nullptr || sharedThis->context_ == nullptr) {
TAG_LOGE(AAFwkTag::APPKIT, "Invalid shared pointer");
return;
}
std::vector<std::string> temps;
if (self->GetObsoleteBundleTempPath(rootDir, temps) != RESULT_OK) {
if (sharedThis->GetObsoleteBundleTempPath(rootDir, temps) != RESULT_OK) {
TAG_LOGE(AAFwkTag::APPKIT, "Get bundle temp file list is false");
return;
}
for (const auto &temp : temps) {
if (self->RemoveDir(temp) == false) {
if (sharedThis->RemoveDir(temp) == false) {
TAG_LOGE(AAFwkTag::APPKIT, "Clean bundle data dir failed, path: %{private}s", temp.c_str());
}
}

View File

@ -149,7 +149,6 @@ AAFwk::UserStatus AssertFaultTaskThread::HandleAssertCallback(const std::string
TAG_LOGE(AAFwkTag::APPKIT, "Invalid client object");
break;
}
std::unique_lock<std::mutex> lockAssertResult(assertResultMutex_);
AAFwk::WantParams wantParams;
wantParams.SetParam(ASSERT_FAULT_DETAIL, AAFwk::String::Box(exprStr));
@ -158,7 +157,6 @@ AAFwk::UserStatus AssertFaultTaskThread::HandleAssertCallback(const std::string
TAG_LOGE(AAFwkTag::APPKIT, "Request assert fault dialog failed");
break;
}
assertResultCV_.wait(lockAssertResult);
assertResult = assertFaultCallback->GetAssertResult();
} while (false);
@ -175,4 +173,4 @@ void AssertFaultTaskThread::NotifyReleaseLongWaiting()
assertResultCV_.notify_one();
}
} // namespace AbilityRuntime
} // namespace OHOS
} // namespace OHOS

View File

@ -213,7 +213,7 @@ std::string ContextContainer::GetAppType()
}
}
void ContextContainer::SetPattern(int patternId)
void ContextContainer::SetPattern(int32_t patternId)
{
if (baseContext_ != nullptr) {
baseContext_->SetPattern(patternId);

View File

@ -132,17 +132,19 @@ bool IdleTime::GetNeedStop()
IdleNotifyStatusCallback IdleTime::GetIdleNotifyFunc()
{
IdleNotifyStatusCallback cb = [this](bool needStop) {
if (this->GetNeedStop() == needStop) {
auto weakThis = weak_from_this();
IdleNotifyStatusCallback cb = [weakThis](bool needStop) {
auto sharedThis = weakThis.lock();
if (sharedThis == nullptr || sharedThis->GetNeedStop() == needStop) {
return;
}
this->SetNeedStop(needStop);
sharedThis->SetNeedStop(needStop);
if (needStop == false) {
this->Start();
sharedThis->Start();
}
};
return cb;
}
} // AppExecFwk
} // namespace OHOS
} // namespace OHOS

View File

@ -180,7 +180,7 @@ public:
*
* @param patternId Indicates the resource ID of the pattern to set.
*/
void SetPattern(int patternId) override;
void SetPattern(int32_t patternId) override;
/**
* @brief Obtains the HapModuleInfo object of the application.