Don't reset handle before Wrappable is destroyed
It is possible that the user wants to use the V8 object in the destructor. Fixes atom/atom-shell#1112.
This commit is contained in:
parent
38aba07290
commit
40da835cbb
6 changed files with 5 additions and 6 deletions
|
@ -176,7 +176,7 @@ class Constructor {
|
||||||
}
|
}
|
||||||
|
|
||||||
base::StringPiece name_;
|
base::StringPiece name_;
|
||||||
v8::Persistent<v8::FunctionTemplate> constructor_;
|
v8::UniquePersistent<v8::FunctionTemplate> constructor_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(Constructor);
|
DISALLOW_COPY_AND_ASSIGN(Constructor);
|
||||||
};
|
};
|
||||||
|
|
|
@ -112,7 +112,7 @@ class Constructor {
|
||||||
}
|
}
|
||||||
|
|
||||||
base::StringPiece name_;
|
base::StringPiece name_;
|
||||||
v8::Persistent<v8::FunctionTemplate> constructor_;
|
v8::UniquePersistent<v8::FunctionTemplate> constructor_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(Constructor);
|
DISALLOW_COPY_AND_ASSIGN(Constructor);
|
||||||
};
|
};
|
||||||
|
|
|
@ -57,7 +57,7 @@ class CallbackHolderBase {
|
||||||
private:
|
private:
|
||||||
static MATE_WEAK_CALLBACK(WeakCallback, v8::External, CallbackHolderBase);
|
static MATE_WEAK_CALLBACK(WeakCallback, v8::External, CallbackHolderBase);
|
||||||
|
|
||||||
v8::Persistent<v8::External> v8_ref_;
|
v8::UniquePersistent<v8::External> v8_ref_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CallbackHolderBase);
|
DISALLOW_COPY_AND_ASSIGN(CallbackHolderBase);
|
||||||
};
|
};
|
||||||
|
|
|
@ -60,7 +60,7 @@ class CallbackHolderBase {
|
||||||
private:
|
private:
|
||||||
static MATE_WEAK_CALLBACK(WeakCallback, v8::External, CallbackHolderBase);
|
static MATE_WEAK_CALLBACK(WeakCallback, v8::External, CallbackHolderBase);
|
||||||
|
|
||||||
v8::Persistent<v8::External> v8_ref_;
|
v8::UniquePersistent<v8::External> v8_ref_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CallbackHolderBase);
|
DISALLOW_COPY_AND_ASSIGN(CallbackHolderBase);
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,7 +46,6 @@ ObjectTemplateBuilder Wrappable::GetObjectTemplateBuilder(
|
||||||
// static
|
// static
|
||||||
MATE_WEAK_CALLBACK(Wrappable::WeakCallback, v8::Object, Wrappable) {
|
MATE_WEAK_CALLBACK(Wrappable::WeakCallback, v8::Object, Wrappable) {
|
||||||
MATE_WEAK_CALLBACK_INIT(Wrappable);
|
MATE_WEAK_CALLBACK_INIT(Wrappable);
|
||||||
MATE_PERSISTENT_RESET(self->wrapper_);
|
|
||||||
delete self;
|
delete self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ class Wrappable {
|
||||||
private:
|
private:
|
||||||
static MATE_WEAK_CALLBACK(WeakCallback, v8::Object, Wrappable);
|
static MATE_WEAK_CALLBACK(WeakCallback, v8::Object, Wrappable);
|
||||||
|
|
||||||
v8::Persistent<v8::Object> wrapper_; // Weak
|
v8::UniquePersistent<v8::Object> wrapper_; // Weak
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(Wrappable);
|
DISALLOW_COPY_AND_ASSIGN(Wrappable);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue