!1084 控件取消加锁处理

Merge pull request !1084 from Abonadon_hk/master
This commit is contained in:
openharmony_ci 2024-10-30 09:20:33 +00:00 committed by Gitee
commit c271e1cd49
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 9 additions and 9 deletions

View File

@ -101,7 +101,7 @@ private:
void End(const ResultCode &resultCode);
std::shared_ptr<ContextCallback> GetAuthContextCallback(AuthType authType, AuthTrustLevel authTrustLevel,
sptr<IamCallbackInterface> &callback);
void StopAllRunTask();
void StopAllRunTask(const ResultCode &resultCode);
std::string BuildStartCommand(const WidgetRotatePara &widgetRotatePara);
void ProcessRotatePara(WidgetCmdParameters &widgetCmdParameters, const WidgetRotatePara &widgetRotatePara);
bool isValidRotate(const WidgetRotatePara &widgetRotatePara);

View File

@ -492,13 +492,7 @@ void WidgetContext::End(const ResultCode &resultCode)
{
IAM_LOGI("in End, resultCode: %{public}d", static_cast<int32_t>(resultCode));
WidgetClient::Instance().Reset();
StopAllRunTask();
if (resultCode != ResultCode::SUCCESS) {
IAM_LOGI("Try to disconnect extesnion");
if (!DisconnectExtension()) {
IAM_LOGE("failed to release launch widget.");
}
}
StopAllRunTask(resultCode);
IF_FALSE_LOGE_AND_RETURN(callerCallback_ != nullptr);
Attributes attr;
if (resultCode == ResultCode::SUCCESS) {
@ -533,7 +527,7 @@ void WidgetContext::End(const ResultCode &resultCode)
callerCallback_->OnResult(resultCode, attr);
}
void WidgetContext::StopAllRunTask()
void WidgetContext::StopAllRunTask(const ResultCode &resultCode)
{
std::lock_guard<std::recursive_mutex> lock(mutex_);
for (auto &taskInfo : runTaskInfoList_) {
@ -545,6 +539,12 @@ void WidgetContext::StopAllRunTask()
taskInfo.task->Stop();
}
runTaskInfoList_.clear();
if (resultCode != ResultCode::SUCCESS) {
IAM_LOGI("Try to disconnect extesnion");
if (!DisconnectExtension()) {
IAM_LOGE("failed to release launch widget.");
}
}
}
std::string WidgetContext::BuildStartCommand(const WidgetRotatePara &widgetRotatePara)