mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
For isolates spawned by the application via `Isolate.spawn()`ed, the VM will create a "lightweight" isolate and invoke the `initialize_isolate` embedder callback to initialize it. The embedder-provided callback will be invoked with the active isolate and is expected to return with that active isolate - irrespective of whether it succeeded to initialize or not. => The unsuccessful path was using `Dart_ExitIsolate()` - which is incorrect. This PR fixes that by not exiting the isolate. As a side-effect of the fix, we also do less `Dart_EnterIsolate()`/`Dart_ExitIsolate()` calls in initialization (which makes it faster) and handle failure to spawn the root isolate. Furthermore this PR removes some dead code and replaces it with `FML_DCHECK()`s instead. The PR adds a test that will set the root library to null which will make the engine fail initializing of the isolate and therefore trigger this error handling path. Fixes https://github.com/flutter/flutter/issues/90478