Skip to content

How to delete an AsyncWorker pointer? #430

@p3x-robot

Description

@p3x-robot

Hello!
How are you? I have a weird problem:

Napi::Value ArrayFireTestAsync(const Napi::CallbackInfo& info) {
 
  Napi::Function callback = info[0].As<Napi::Function>();

  // who is going to free up / delete this pointer???
  ArrayTestWorker* testWorker = new ArrayTestWorker(callback);
  testWorker->Queue();

  return  info.Env().Undefined();
}

It looks like the testWorker is a pointer, but when is it going to be freed up/deleted? The example was no info how to delete this pointer... Is this valid code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions