Ensure that AutoIsolateShutdown drops its reference to the DartIsolate on the intended task runner (flutter/engine#25899)

This commit is contained in:
Jason Simmons
2021-05-06 20:24:02 -07:00
committed by GitHub
parent 1734ce7f8a
commit 4d71fc5b8b

View File

@@ -17,11 +17,11 @@ AutoIsolateShutdown::~AutoIsolateShutdown() {
Shutdown();
}
fml::AutoResetWaitableEvent latch;
fml::TaskRunner::RunNowOrPostTask(runner_,
[isolate = std::move(isolate_), &latch]() {
// Delete isolate on thread.
latch.Signal();
});
fml::TaskRunner::RunNowOrPostTask(runner_, [this, &latch]() {
// Delete isolate on thread.
isolate_.reset();
latch.Signal();
});
latch.Wait();
}