Merge pull request #10889 from electron/avoid-eventemitter-crashes
Avoid EventEmitter crashes
This commit is contained in:
commit
b429dafa38
5 changed files with 12 additions and 5 deletions
|
@ -169,10 +169,10 @@ void Notification::NotificationDisplayed() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notification::NotificationDestroyed() {
|
void Notification::NotificationDestroyed() {
|
||||||
Emit("close");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notification::NotificationClosed() {
|
void Notification::NotificationClosed() {
|
||||||
|
Emit("close");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Showing notifications
|
// Showing notifications
|
||||||
|
|
|
@ -79,8 +79,12 @@ class EventEmitter : public Wrappable<T> {
|
||||||
const Args&... args) {
|
const Args&... args) {
|
||||||
v8::Locker locker(isolate());
|
v8::Locker locker(isolate());
|
||||||
v8::HandleScope handle_scope(isolate());
|
v8::HandleScope handle_scope(isolate());
|
||||||
|
v8::Local<v8::Object> wrapper = GetWrapper();
|
||||||
|
if (wrapper.IsEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
v8::Local<v8::Object> event = internal::CreateJSEvent(
|
v8::Local<v8::Object> event = internal::CreateJSEvent(
|
||||||
isolate(), GetWrapper(), sender, message);
|
isolate(), wrapper, sender, message);
|
||||||
return EmitWithEvent(name, event, args...);
|
return EmitWithEvent(name, event, args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,10 @@ class TrackableObject : public TrackableObjectBase,
|
||||||
public:
|
public:
|
||||||
// Mark the JS object as destroyed.
|
// Mark the JS object as destroyed.
|
||||||
void MarkDestroyed() {
|
void MarkDestroyed() {
|
||||||
Wrappable<T>::GetWrapper()->SetAlignedPointerInInternalField(0, nullptr);
|
v8::Local<v8::Object> wrapper = Wrappable<T>::GetWrapper();
|
||||||
|
if (!wrapper.IsEmpty()) {
|
||||||
|
wrapper->SetAlignedPointerInInternalField(0, nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsDestroyed() {
|
bool IsDestroyed() {
|
||||||
|
|
|
@ -74,7 +74,7 @@ Returns:
|
||||||
|
|
||||||
Emitted when the notification is closed by manual intervention from the user.
|
Emitted when the notification is closed by manual intervention from the user.
|
||||||
|
|
||||||
This event is not guarunteed to be emitted in all cases where the notification
|
This event is not guaranteed to be emitted in all cases where the notification
|
||||||
is closed.
|
is closed.
|
||||||
|
|
||||||
#### Event: 'reply' _macOS_
|
#### Event: 'reply' _macOS_
|
||||||
|
|
2
vendor/native_mate
vendored
2
vendor/native_mate
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit f047bb61bbd985079dd93e7ed322999550efed1d
|
Subproject commit bf92fa88b735b8c9ff951e6ef78a531bd10e8778
|
Loading…
Add table
Add a link
Reference in a new issue