mirror of
https://gitee.com/openharmony/account_os_account
synced 2024-11-27 04:00:43 +00:00
!2213 AppAccountAuthenticatorSession SA多线程给authenticatorProxy_添加锁
Merge pull request !2213 from zhenghui/master
This commit is contained in:
commit
d74b0526d1
@ -95,6 +95,7 @@ private:
|
||||
int32_t OnAddAccountImplicitlyDone(const AAFwk::Want &result) const;
|
||||
|
||||
private:
|
||||
std::mutex mutex_;
|
||||
sptr<SessionConnection> conn_ = nullptr;
|
||||
sptr<SessionClientDeathRecipient> clientDeathRecipient_ = nullptr;
|
||||
sptr<SessionServerDeathRecipient> serverDeathRecipient_ = nullptr;
|
||||
|
@ -139,6 +139,7 @@ ErrCode AppAccountAuthenticatorSession::Open()
|
||||
|
||||
void AppAccountAuthenticatorSession::Close()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
if ((authenticatorProxy_ != nullptr) && (authenticatorProxy_->AsObject() != nullptr)) {
|
||||
authenticatorProxy_->AsObject()->RemoveDeathRecipient(serverDeathRecipient_);
|
||||
}
|
||||
@ -174,11 +175,11 @@ ErrCode AppAccountAuthenticatorSession::AddClientDeathRecipient()
|
||||
void AppAccountAuthenticatorSession::OnAbilityConnectDone(
|
||||
const AppExecFwk::ElementName &element, const sptr<IRemoteObject> &remoteObject, int32_t resultCode)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
isConnected_ = true;
|
||||
AAFwk::Want errResult;
|
||||
authenticatorProxy_ = iface_cast<IAppAccountAuthenticator>(remoteObject);
|
||||
if ((!authenticatorProxy_) || (!authenticatorProxy_->AsObject())) {
|
||||
ACCOUNT_LOGE("failed to cast app account authenticator proxy");
|
||||
OnResult(ERR_JS_ACCOUNT_AUTHENTICATOR_SERVICE_EXCEPTION, errResult);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user