mirror of
https://github.com/electron/electron.git
synced 2026-01-27 08:18:28 -05:00
Merge pull request #10889 from electron/avoid-eventemitter-crashes
Avoid EventEmitter crashes
This commit is contained in:
@@ -169,10 +169,10 @@ void Notification::NotificationDisplayed() {
|
||||
}
|
||||
|
||||
void Notification::NotificationDestroyed() {
|
||||
Emit("close");
|
||||
}
|
||||
|
||||
void Notification::NotificationClosed() {
|
||||
Emit("close");
|
||||
}
|
||||
|
||||
// Showing notifications
|
||||
|
||||
@@ -79,8 +79,12 @@ class EventEmitter : public Wrappable<T> {
|
||||
const Args&... args) {
|
||||
v8::Locker locker(isolate());
|
||||
v8::HandleScope handle_scope(isolate());
|
||||
v8::Local<v8::Object> wrapper = GetWrapper();
|
||||
if (wrapper.IsEmpty()) {
|
||||
return false;
|
||||
}
|
||||
v8::Local<v8::Object> event = internal::CreateJSEvent(
|
||||
isolate(), GetWrapper(), sender, message);
|
||||
isolate(), wrapper, sender, message);
|
||||
return EmitWithEvent(name, event, args...);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,10 @@ class TrackableObject : public TrackableObjectBase,
|
||||
public:
|
||||
// Mark the JS object as destroyed.
|
||||
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() {
|
||||
|
||||
@@ -74,7 +74,7 @@ Returns:
|
||||
|
||||
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.
|
||||
|
||||
#### Event: 'reply' _macOS_
|
||||
|
||||
2
vendor/native_mate
vendored
2
vendor/native_mate
vendored
Submodule vendor/native_mate updated: f047bb61bb...bf92fa88b7
Reference in New Issue
Block a user