mirror of
https://gitee.com/openharmony/multimedia_image_framework
synced 2024-11-23 15:10:26 +00:00
Fix CreatePicture Napi OOM
Issue: https://gitee.com/openharmony/multimedia_image_framework/issues/IAYISF Signed-off-by: caochuan <caochuan@huawei.com> Change-Id: Iaf2ae3435f8e7dfafbae0e446aced190fa06602a
This commit is contained in:
parent
fbfa910f04
commit
851e0719d8
@ -304,7 +304,7 @@ napi_value PictureNapi::Constructor(napi_env env, napi_callback_info info)
|
||||
std::unique_ptr<PictureNapi> pPictureNapi = std::make_unique<PictureNapi>();
|
||||
if (pPictureNapi != nullptr) {
|
||||
pPictureNapi->env_ = env;
|
||||
pPictureNapi->nativePicture_ = sPicture_;
|
||||
pPictureNapi->nativePicture_ = std::move(sPicture_);
|
||||
if (pPictureNapi->nativePicture_ == nullptr) {
|
||||
IMAGE_LOGE("Failed to set nativePicture_ with null. Maybe a reentrancy error");
|
||||
}
|
||||
@ -327,7 +327,7 @@ void PictureNapi::Destructor(napi_env env, void *nativeObject, void *finalize)
|
||||
}
|
||||
}
|
||||
|
||||
napi_value PictureNapi::CreatePicture(napi_env env, std::shared_ptr<Picture> picture)
|
||||
napi_value PictureNapi::CreatePicture(napi_env env, std::shared_ptr<Picture> &picture)
|
||||
{
|
||||
if (sConstructor_ == nullptr) {
|
||||
napi_value exports = nullptr;
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
|
||||
static napi_value Init(napi_env env, napi_value exports);
|
||||
static std::shared_ptr<Picture> GetPicture(napi_env env, napi_value picture);
|
||||
static napi_value CreatePicture(napi_env env, std::shared_ptr<Picture> picture);
|
||||
static napi_value CreatePicture(napi_env env, std::shared_ptr<Picture> &picture);
|
||||
static int32_t CreatePictureNapi(napi_env env, napi_value* result);
|
||||
void SetNativePicture(std::shared_ptr<Picture> picture);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user