Skip to content

Commit

Permalink
Retrieve the last error from the proper thread (flutter#3649)
Browse files Browse the repository at this point in the history
Previously, the last error was a global static. Now it is a thread-specific
value, which means we need to visit the UI thread to read the value.
  • Loading branch information
abarth authored May 5, 2017
1 parent 0efcb4a commit 9cfc67e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions shell/platform/linux/main_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,14 @@ void RunNonInteractive(ftl::CommandLine initial_command_line,
test_runner.platform_view().engine().GetLoadScriptError();
if (error == tonic::kNoError)
error = task_observer.last_error();
if (error == tonic::kNoError)
error = tonic::DartMicrotaskQueue::GetForCurrentThread()->GetLastError();
if (error == tonic::kNoError) {
ftl::AutoResetWaitableEvent latch;
blink::Threads::UI()->PostTask([&error, &latch] {
error = tonic::DartMicrotaskQueue::GetForCurrentThread()->GetLastError();
latch.Signal();
});
latch.Wait();
}

// The script has completed and the engine may not be in a clean state,
// so just stop the process.
Expand Down

0 comments on commit 9cfc67e

Please sign in to comment.