We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 563bed0 commit 64f6462Copy full SHA for 64f6462
src/async_wrap.cc
@@ -419,14 +419,14 @@ void AsyncWrap::WeakCallback(const v8::WeakCallbackInfo<DestroyParam>& info) {
419
HandleScope scope(info.GetIsolate());
420
421
Environment* env = Environment::GetCurrent(info.GetIsolate());
422
- DestroyParam* p = info.GetParameter();
+ std::unique_ptr<DestroyParam> p{info.GetParameter()};
423
Local<Object> prop_bag = PersistentToLocal(info.GetIsolate(), p->propBag);
424
425
Local<Value> val = prop_bag->Get(env->destroyed_string());
426
if (val->IsFalse()) {
427
AsyncWrap::EmitDestroy(env, p->asyncId);
428
}
429
- delete p;
+ // unique_ptr goes out of scope here and pointer is deleted.
430
431
432
0 commit comments