diff --git a/src/handle_wrap.h b/src/handle_wrap.h index 6e6f3904b8..cbe7e3248b 100644 --- a/src/handle_wrap.h +++ b/src/handle_wrap.h @@ -69,7 +69,7 @@ class HandleWrap { virtual ~HandleWrap(); inline v8::Local object() { - return v8::Local::New(node_isolate, persistent()); + return PersistentToLocal(node_isolate, persistent()); } inline v8::Persistent& persistent() { diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 540d9cdabc..e68d91dccb 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -3315,6 +3315,9 @@ void EIO_PBKDF2After(uv_work_t* work_req, int status) { assert(status == 0); pbkdf2_req* req = container_of(work_req, pbkdf2_req, work_req); HandleScope scope(node_isolate); + // Create a new Local that's associated with the current HandleScope. + // PersistentToLocal() returns a handle that gets zeroed when we call + // Dispose() so don't use that. Local obj = Local::New(node_isolate, req->obj); req->obj.Dispose(); Local argv[2]; diff --git a/src/node_script.cc b/src/node_script.cc index 9c6a598848..d155c51fad 100644 --- a/src/node_script.cc +++ b/src/node_script.cc @@ -174,7 +174,7 @@ Local WrappedContext::NewInstance() { Local WrappedContext::GetV8Context() { - return Local::New(node_isolate, context_); + return PersistentToLocal(node_isolate, context_); } @@ -404,7 +404,7 @@ void WrappedScript::EvalMachine(const FunctionCallbackInfo& args) { "'this' must be a result of previous new Script(code) call."); } - script = Local