mirror of
https://gitee.com/openharmony/communication_ipc
synced 2024-11-23 07:50:24 +00:00
fix:Delete objects in the table after the WaitForInit function fails to execute
Signed-off-by: chenchong_666 <chenchong57@huawei.com>
This commit is contained in:
parent
fb1eb7a673
commit
94a3599fe0
@ -43,7 +43,9 @@ using namespace Communication;
|
||||
using namespace OHOS::HiviewDFX;
|
||||
|
||||
static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_ID_IPC_PROC_SKELETON, "IPCProcessSkeleton" };
|
||||
|
||||
#ifndef CONFIG_IPC_SINGLE
|
||||
static constexpr int32_t DETACH_PROXY_REF_COUNT = 2;
|
||||
#endif
|
||||
std::mutex IPCProcessSkeleton::procMutex_;
|
||||
IPCProcessSkeleton *IPCProcessSkeleton::instance_ = nullptr;
|
||||
IPCProcessSkeleton::DestroyInstance IPCProcessSkeleton::destroyInstance_;
|
||||
@ -207,6 +209,9 @@ sptr<IRemoteObject> IPCProcessSkeleton::FindOrNewObject(int handle)
|
||||
#ifndef CONFIG_IPC_SINGLE
|
||||
if (proxy->GetProto() == IRemoteObject::IF_PROT_ERROR) {
|
||||
ZLOGE(LOG_LABEL, "init rpc proxy failed, handle:%{public}d", handle);
|
||||
if (proxy->GetSptrRefCount() <= DETACH_PROXY_REF_COUNT) {
|
||||
DetachObject(result.GetRefPtr());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@ -532,7 +537,7 @@ std::shared_ptr<DBinderSessionObject> IPCProcessSkeleton::ProxyDetachDBinderSess
|
||||
} else {
|
||||
ZLOGW(LOG_LABEL, "detach handle:%{Public}u, not found", handle);
|
||||
}
|
||||
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user