Merge pull request #15 from mgc/muon-crash-workarounds

Upstream Muon changes to avoid crashing
This commit is contained in:
Cheng Zhao 2017-10-26 18:46:25 +09:00 committed by GitHub
commit bf92fa88b7
2 changed files with 8 additions and 2 deletions

View file

@ -21,6 +21,9 @@ namespace internal {
struct Destroyable { struct Destroyable {
static void Destroy(Arguments* args) { static void Destroy(Arguments* args) {
if (IsDestroyed(args))
return;
v8::Local<v8::Object> holder = args->GetHolder(); v8::Local<v8::Object> holder = args->GetHolder();
delete static_cast<WrappableBase*>( delete static_cast<WrappableBase*>(
holder->GetAlignedPointerFromInternalField(0)); holder->GetAlignedPointerFromInternalField(0));

View file

@ -24,8 +24,11 @@ WrappableBase::~WrappableBase() {
} }
v8::Local<v8::Object> WrappableBase::GetWrapper() { v8::Local<v8::Object> WrappableBase::GetWrapper() {
CHECK(!wrapper_.IsEmpty()); DCHECK(!wrapper_.IsEmpty());
return v8::Local<v8::Object>::New(isolate_, wrapper_); if (!wrapper_.IsEmpty())
return v8::Local<v8::Object>::New(isolate_, wrapper_);
else
return v8::Local<v8::Object>();
} }
void WrappableBase::InitWith(v8::Isolate* isolate, void WrappableBase::InitWith(v8::Isolate* isolate,