From 460b194c9e42a3413c64fd4e25b97a4c546d4fdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyour?= Date: Thu, 24 Feb 2022 06:38:01 -0800 Subject: [PATCH] device_ready_status bug Signed-off-by: pang-wenbin2 --- ext/profile/include/device_profile_adapter.h | 3 ++- ext/profile/src/device_profile_adapter.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/profile/include/device_profile_adapter.h b/ext/profile/include/device_profile_adapter.h index 3703a619a..0155daae8 100644 --- a/ext/profile/include/device_profile_adapter.h +++ b/ext/profile/include/device_profile_adapter.h @@ -24,7 +24,8 @@ namespace OHOS { namespace DistributedHardware { -class DeviceProfileAdapter : public IProfileAdapter, public IProfileConnectorCallback { +class DeviceProfileAdapter : public IProfileAdapter, public IProfileConnectorCallback, //{ + public std::enable_shared_from_this { public: DeviceProfileAdapter(); ~DeviceProfileAdapter(); diff --git a/ext/profile/src/device_profile_adapter.cpp b/ext/profile/src/device_profile_adapter.cpp index 5d6165a01..81e520d78 100644 --- a/ext/profile/src/device_profile_adapter.cpp +++ b/ext/profile/src/device_profile_adapter.cpp @@ -36,7 +36,8 @@ int32_t DeviceProfileAdapter::RegisterProfileListener(const std::string &pkgName { LOGI("DeviceProfileAdapter::RegisterProfileListener"); deviceProfileAdapterCallback_ = callback; - profileConnector_->RegisterProfileCallback(pkgName, deviceId, std::shared_ptr(this)); + // profileConnector_->RegisterProfileCallback(pkgName, deviceId, std::shared_ptr(this)); + profileConnector_->RegisterProfileCallback(pkgName, deviceId, shared_from_this()); return DM_OK; } -- Gitee