Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use handle_scope.Close() with values from the caches

  • Loading branch information...
commit 246177bd16b94ad3c202cae710bfefea521a44c2 1 parent 8aeb1c8
@evax evax authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 c_src/erlv8_term.cc
View
4 c_src/erlv8_term.cc
@@ -94,7 +94,7 @@ v8::Handle<v8::Object> externalize_term(map<ERL_NIF_TERM, v8::Handle<v8::Object>
map<ERL_NIF_TERM, v8::Handle<v8::Object>, cmp_erl_nif_term>::iterator iter = cache.find(term);
if (iter != cache.end()) {
- return iter->second; // it was cached before
+ return handle_scope.Close(iter->second); // it was cached before
} else {
v8::Handle<v8::Value> external = term_to_external(term);
v8::Handle<v8::Object> obj = external_template->NewInstance();
@@ -240,7 +240,7 @@ v8::Handle<v8::Value> term_to_js(v8::Handle<v8::Context> ctx, ErlNifEnv *env, ER
map<ERL_NIF_TERM, v8::Handle<v8::FunctionTemplate>, cmp_erl_nif_term>::iterator iter = vm->fun_map.find(term);
if (iter != vm->fun_map.end()) {
- return iter->second->GetFunction(); // it was cached before
+ return handle_scope.Close(iter->second->GetFunction()); // it was cached before
} else {
v8::Handle<v8::Value> external = term_to_external(term);
v8::Persistent<v8::FunctionTemplate> t = v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New(WrapFun,external));
Please sign in to comment.
Something went wrong with that request. Please try again.