Skip to content

Commit

Permalink
[dart-runner] Avoid calling Destroy on nullptr (flutter#23608)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaselatta authored Jan 12, 2021
1 parent 0f9fc3d commit a1e7424
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,11 @@ bool DartComponentController::Main() {

void DartComponentController::Kill() {
if (Dart_CurrentIsolate()) {
tonic::DartMicrotaskQueue::GetForCurrentThread()->Destroy();
tonic::DartMicrotaskQueue* queue =
tonic::DartMicrotaskQueue::GetForCurrentThread();
if (queue) {
queue->Destroy();
}

loop_->Quit();

Expand Down
7 changes: 6 additions & 1 deletion shell/platform/fuchsia/dart_runner/dart_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ void IsolateShutdownCallback(void* isolate_group_data, void* isolate_data) {
auto dispatcher = async_get_default_dispatcher();
auto loop = async_loop_from_dispatcher(dispatcher);
if (loop) {
tonic::DartMicrotaskQueue::GetForCurrentThread()->Destroy();
tonic::DartMicrotaskQueue* queue =
tonic::DartMicrotaskQueue::GetForCurrentThread();
if (queue) {
queue->Destroy();
}

async_loop_quit(loop);
}

Expand Down

0 comments on commit a1e7424

Please sign in to comment.