Create a HandleScope before calling callbacks

This commit is contained in:
Scott Kyle 2016-05-17 16:40:10 -07:00
parent 938c7fb2f4
commit 5198a5bf4b
1 changed files with 4 additions and 0 deletions

View File

@ -16,6 +16,8 @@
// //
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
#include <nan.h>
#include "impl/weak_realm_notifier.hpp" #include "impl/weak_realm_notifier.hpp"
#include "shared_realm.hpp" #include "shared_realm.hpp"
@ -35,6 +37,8 @@ WeakRealmNotifier::WeakRealmNotifier(const std::shared_ptr<Realm>& realm, bool c
auto realm = realm_weak_ptr->lock(); auto realm = realm_weak_ptr->lock();
if (realm) { if (realm) {
// The v8::Local handles need a "scope" to be present or will crash.
Nan::HandleScope scope;
realm->notify(); realm->notify();
} }
}); });