[ VM / Service ] Fix crash when embedder service event is posted while

there is no current isolate

Fixes issue #46612

TEST=Existing tests, manual testing

Change-Id: I88e1f7185b0ccaa6dcd73ccae05935af074dcad4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/221562
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Ben Konyi 2021-11-29 21:45:04 +00:00 committed by Commit Bot
parent 64ebe56f5f
commit 9c8f51f538
2 changed files with 4 additions and 2 deletions

View file

@ -4523,7 +4523,7 @@ void Service::SendEmbedderEvent(Isolate* isolate,
event.set_embedder_kind(event_kind);
event.set_embedder_stream_id(stream_id);
event.set_bytes(bytes, bytes_len);
Service::HandleEvent(&event);
Service::HandleEvent(&event, /*enter_safepoint=*/false);
}
void Service::SendLogEvent(Isolate* isolate,

View file

@ -20,7 +20,9 @@ ServiceEvent::ServiceEvent(IsolateGroup* isolate_group, EventKind event_kind)
: ServiceEvent(isolate_group, nullptr, event_kind) {}
ServiceEvent::ServiceEvent(Isolate* isolate, EventKind event_kind)
: ServiceEvent(isolate->group(), isolate, event_kind) {}
: ServiceEvent(isolate != nullptr ? isolate->group() : nullptr,
isolate,
event_kind) {}
ServiceEvent::ServiceEvent(IsolateGroup* isolate_group,
Isolate* isolate,