From 9991411908d49000c9fc905dd2cbbf81a1365f8a Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Mon, 17 Oct 2022 12:50:10 -0700 Subject: [PATCH 1/5] Dart_NotifyDestroyed. --- shell/common/shell.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 20ca64b8578e9..a5e8ea2606b29 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -899,6 +899,8 @@ void Shell::OnPlatformViewDestroyed() { // Overall, the longer term plan is to remove this implementation once // https://github.com/flutter/flutter/issues/96679 is fixed. rasterizer_->TeardownExternalViewEmbedder(); + + ::Dart_NotifyDestroyed(); } // |PlatformView::Delegate| From 39e1428419d19a9551dd2e100680993a37d7af7f Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Tue, 18 Oct 2022 14:26:12 -0700 Subject: [PATCH 2/5] . --- shell/common/shell.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/common/shell.cc b/shell/common/shell.cc index a5e8ea2606b29..c26e1d54a0514 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -900,7 +900,8 @@ void Shell::OnPlatformViewDestroyed() { // https://github.com/flutter/flutter/issues/96679 is fixed. rasterizer_->TeardownExternalViewEmbedder(); - ::Dart_NotifyDestroyed(); + fml::TaskRunner::RunNowOrPostTask(ui_task_runner, + [] { ::Dart_NotifyDestroyed(); }); } // |PlatformView::Delegate| From 64896769a2d3074e1fbe378754f7c9fb58c125ec Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Tue, 18 Oct 2022 16:20:24 -0700 Subject: [PATCH 3/5] . --- shell/common/shell.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/common/shell.cc b/shell/common/shell.cc index c26e1d54a0514..d1b2565298f48 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -900,7 +900,7 @@ void Shell::OnPlatformViewDestroyed() { // https://github.com/flutter/flutter/issues/96679 is fixed. rasterizer_->TeardownExternalViewEmbedder(); - fml::TaskRunner::RunNowOrPostTask(ui_task_runner, + fml::TaskRunner::RunNowOrPostTask(task_runners_.GetUITaskRunner(), [] { ::Dart_NotifyDestroyed(); }); } From 515a7e4e6591a72bcb1076c801c6ec9bfddfc2af Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Fri, 21 Oct 2022 13:48:49 -0700 Subject: [PATCH 4/5] . --- shell/common/shell.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/common/shell.cc b/shell/common/shell.cc index d1b2565298f48..141cec27530e0 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -900,8 +900,10 @@ void Shell::OnPlatformViewDestroyed() { // https://github.com/flutter/flutter/issues/96679 is fixed. rasterizer_->TeardownExternalViewEmbedder(); - fml::TaskRunner::RunNowOrPostTask(task_runners_.GetUITaskRunner(), - [] { ::Dart_NotifyDestroyed(); }); + fml::TaskRunner::RunNowOrPostTask(task_runners_.GetUITaskRunner(), [] { + DartState::Scope scope(DartState::Current()); + ::Dart_NotifyDestroyed(); + }); } // |PlatformView::Delegate| From fedef55a0e81f0b37fbe757c12e6661e8f1fe6d8 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Fri, 21 Oct 2022 15:47:01 -0700 Subject: [PATCH 5/5] . --- shell/common/shell.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 141cec27530e0..112eb41a3c95c 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -32,6 +32,7 @@ #include "third_party/skia/include/core/SkGraphics.h" #include "third_party/skia/include/utils/SkBase64.h" #include "third_party/tonic/common/log.h" +#include "third_party/tonic/dart_state.h" namespace flutter { @@ -901,7 +902,7 @@ void Shell::OnPlatformViewDestroyed() { rasterizer_->TeardownExternalViewEmbedder(); fml::TaskRunner::RunNowOrPostTask(task_runners_.GetUITaskRunner(), [] { - DartState::Scope scope(DartState::Current()); + tonic::DartState::Scope scope(tonic::DartState::Current()); ::Dart_NotifyDestroyed(); }); }