未验证 提交 28592626 编写于 作者: O openharmony_ci 提交者: Gitee

!77 【轻量级 PR】:description:修改智能指针与原指针使用问题

Merge pull request !77 from bigpumpkin/N/A
......@@ -44,7 +44,7 @@ public:
};
bool SendDataToRemote(const std::string &deviceId, const struct DHandleEntryTxRx *msg);
bool StartListener();
bool StartListener(std::shared_ptr<DBinderRemoteListener> &listener);
bool StopListener();
bool CloseDatabusSession(const std::string &deviceId);
......
......@@ -102,7 +102,7 @@ bool DBinderService::StartRemoteListener()
return false;
}
if (remoteListener_->StartListener() != true) {
if (remoteListener_->StartListener(remoteListener_) != true) {
StopRemoteListener();
return false;
}
......
......@@ -32,7 +32,7 @@ DBinderRemoteListener::~DBinderRemoteListener()
DBINDER_LOGI("delete dbinder remote listener");
}
bool DBinderRemoteListener::StartListener()
bool DBinderRemoteListener::StartListener(std::shared_ptr<DBinderRemoteListener> &listener)
{
std::lock_guard<std::mutex> lockGuard(busManagerMutex_);
std::shared_ptr<ISessionService> softbusManager_ = ISessionService::GetInstance();
......@@ -40,8 +40,7 @@ bool DBinderRemoteListener::StartListener()
DBINDER_LOGE("fail to get softbus service");
return false;
}
std::shared_ptr<ISessionListener> callbacks(this);
int ret = softbusManager_->CreateSessionServer(OWN_SESSION_NAME, PEER_SESSION_NAME, callbacks);
int ret = softbusManager_->CreateSessionServer(OWN_SESSION_NAME, PEER_SESSION_NAME, listener);
if (ret != 0) {
DBINDER_LOGE("fail to create softbus server with ret = %{public}d", ret);
return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册