From 0e38efd32351474c5818d5101543faed3ab97b85 Mon Sep 17 00:00:00 2001 From: g00613291 Date: Thu, 5 Dec 2024 19:11:29 +0800 Subject: [PATCH] fix ref clean Signed-off-by: g00613291 --- interfaces/kits/js/backup/session_backup_n_exporter.cpp | 2 +- .../kits/js/backup/session_incremental_backup_n_exporter.cpp | 2 +- interfaces/kits/js/backup/session_restore_n_exporter.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interfaces/kits/js/backup/session_backup_n_exporter.cpp b/interfaces/kits/js/backup/session_backup_n_exporter.cpp index c7e09daa3..a2850d505 100644 --- a/interfaces/kits/js/backup/session_backup_n_exporter.cpp +++ b/interfaces/kits/js/backup/session_backup_n_exporter.cpp @@ -308,7 +308,7 @@ static void OnProcess(weak_ptr pCallbacks, const BundleName na static bool SetSessionBackupEntity(napi_env env, NFuncArg &funcArg, std::unique_ptr backupEntity) { auto finalize = [](napi_env env, void *data, void *hint) { - BackupEntity *entity = static_cast(data); + std::unique_ptr entity = std::unique_ptr(static_cast(data)); if (entity == nullptr) { HILOGE("Entity is nullptr"); return; diff --git a/interfaces/kits/js/backup/session_incremental_backup_n_exporter.cpp b/interfaces/kits/js/backup/session_incremental_backup_n_exporter.cpp index e50e81c14..f1feabd90 100644 --- a/interfaces/kits/js/backup/session_incremental_backup_n_exporter.cpp +++ b/interfaces/kits/js/backup/session_incremental_backup_n_exporter.cpp @@ -312,7 +312,7 @@ static void OnProcess(weak_ptr pCallbacks, const BundleName na static bool SetIncrementalBackupEntity(napi_env env, NFuncArg &funcArg, std::unique_ptr backupEntity) { auto finalize = [](napi_env env, void *data, void *hint) { - BackupEntity *entity = static_cast(data); + std::unique_ptr entity = std::unique_ptr(static_cast(data)); if (entity == nullptr) { HILOGE("Entity is nullptr"); return; diff --git a/interfaces/kits/js/backup/session_restore_n_exporter.cpp b/interfaces/kits/js/backup/session_restore_n_exporter.cpp index 21bf2996b..405ecf334 100644 --- a/interfaces/kits/js/backup/session_restore_n_exporter.cpp +++ b/interfaces/kits/js/backup/session_restore_n_exporter.cpp @@ -423,7 +423,7 @@ static bool VerifyNarg(napi_env env, NVal &callbacks) static bool SetSessionRestoreEntity(napi_env env, NFuncArg &funcArg, std::unique_ptr restoreEntity) { auto finalize = [](napi_env env, void *data, void *hint) { - RestoreEntity *entity = static_cast(data); + std::unique_ptr entity = std::unique_ptr(static_cast(data)); if (entity == nullptr) { HILOGE("Entity is nullptr"); return; -- Gitee