fix: enter handle scope when creating custom event (#22657)
This commit is contained in:
parent
18c74a11f4
commit
7814c67830
1 changed files with 2 additions and 2 deletions
|
@ -62,6 +62,8 @@ class EventEmitter : public gin_helper::Wrappable<T> {
|
|||
// this.emit(name, new Event(flags), args...);
|
||||
template <typename... Args>
|
||||
bool EmitWithFlags(base::StringPiece name, int flags, Args&&... args) {
|
||||
v8::Locker locker(isolate());
|
||||
v8::HandleScope handle_scope(isolate());
|
||||
return EmitCustomEvent(name,
|
||||
internal::CreateEventFromFlags(isolate(), flags),
|
||||
std::forward<Args>(args)...);
|
||||
|
@ -108,8 +110,6 @@ class EventEmitter : public gin_helper::Wrappable<T> {
|
|||
// It's possible that |this| will be deleted by EmitEvent, so save anything
|
||||
// we need from |this| before calling EmitEvent.
|
||||
auto* isolate = this->isolate();
|
||||
v8::Locker locker(isolate);
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
auto context = isolate->GetCurrentContext();
|
||||
gin_helper::EmitEvent(isolate, GetWrapper(), name, event,
|
||||
std::forward<Args>(args)...);
|
||||
|
|
Loading…
Reference in a new issue