| Index: runtime/vm/dart_api_impl.cc
|
| diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
|
| index bf2dfd144eece2a4c5d9e1fe4595526dcdab8de2..8dd7c2d5fbca796868e51b8dfa51b27212679270 100644
|
| --- a/runtime/vm/dart_api_impl.cc
|
| +++ b/runtime/vm/dart_api_impl.cc
|
| @@ -1301,23 +1301,28 @@ DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri,
|
| Thread::EnsureInit();
|
| Isolate* isolate = Dart::CreateIsolate(isolate_name);
|
| free(isolate_name);
|
| - {
|
| - StackZone zone(isolate);
|
| - HANDLESCOPE(isolate);
|
| - const Error& error_obj =
|
| - Error::Handle(isolate,
|
| - Dart::InitializeIsolate(snapshot, callback_data));
|
| - if (error_obj.IsNull()) {
|
| + StackZone zone(isolate);
|
| + HANDLESCOPE(isolate);
|
| + // We enter an API scope here as InitializeIsolate could compile some
|
| + // bootstrap library files which call out to a tag handler that may create
|
| + // Api Handles when an error is encountered.
|
| + Dart_EnterScope();
|
| + const Error& error_obj =
|
| + Error::Handle(isolate, Dart::InitializeIsolate(snapshot, callback_data));
|
| + if (error_obj.IsNull()) {
|
| #if defined(DART_NO_SNAPSHOT)
|
| - if (FLAG_check_function_fingerprints) {
|
| - Library::CheckFunctionFingerprints();
|
| - }
|
| -#endif // defined(DART_NO_SNAPSHOT).
|
| - START_TIMER(isolate, time_total_runtime);
|
| - return Api::CastIsolate(isolate);
|
| + if (FLAG_check_function_fingerprints) {
|
| + Library::CheckFunctionFingerprints();
|
| }
|
| - *error = strdup(error_obj.ToErrorCString());
|
| - }
|
| +#endif // defined(DART_NO_SNAPSHOT).
|
| + // We exit the API scope entered above.
|
| + Dart_ExitScope();
|
| + START_TIMER(isolate, time_total_runtime);
|
| + return Api::CastIsolate(isolate);
|
| + }
|
| + *error = strdup(error_obj.ToErrorCString());
|
| + // We exit the API scope entered above.
|
| + Dart_ExitScope();
|
| Dart::ShutdownIsolate();
|
| return DART_ILLEGAL_ISOLATE;
|
| }
|
|
|