commit | 23fc43d5e61f5d45bf30fbdf6faed1623597c486 | [log] [tgz] |
---|---|---|
author | Chris Bracken <chris@bracken.jp> | Tue Dec 10 11:06:13 2024 -0800 |
committer | GitHub <noreply@github.com> | Tue Dec 10 19:06:13 2024 +0000 |
tree | 3f4c3c04e652030671ede8d28d892e58810b534b | |
parent | 3f796274ab2a31e2147a78d9f81a6f24c9b97f98 [diff] |
iOS: Add null checks on shell dereference (#57099) `FlutterEngine` at the `_shell` unique_ptr ivar it owns have different lifetimes. `_shell` is initialised transitively from `runWithEntrypoint`, and reset in `[FlutterEngine destroyContext]`, which is called transitively from `[FlutterviewController dealloc]` via `[FlutterEngine notifyViewControllerDeallocated]`. As such, all uses of `_shell` should be checked either via an assertion, in cases we know the shell should be non-null, or via a runtime null check in cases where it's expected that it may be null. Specifically, this guards against a crash that can occur if we get a CoreAnimation transaction commit callback for an inflight frame just as we're shutting down the app (or removing the FlutterView in an add-to-app scenario). Example stack trace: ``` 0 Flutter 0x11b28 -[FlutterEngine platformView] + 53 (weak_ptr.h:53) 1 Flutter 0x11994 -[FlutterEngine updateViewportMetrics:] + 186 (ref_ptr.h:186) 2 Flutter 0x1f854 -[FlutterViewController updateViewportMetricsIfNeeded] + 427 (vector:427) 3 Flutter 0x1f9b8 -[FlutterViewController viewDidLayoutSubviews] + 1411 (FlutterViewController.mm:1411) 4 UIKitCore 0x8c864 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2376 5 QuartzCore 0x1fa0c CA::Layer::layout_if_needed(CA::Transaction*) + 516 6 QuartzCore 0x1ae84c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 516 7 QuartzCore 0x2888 CA::Transaction::commit() + 648 ``` Issue: https://github.com/flutter/flutter/issues/98735 Issue: https://github.com/flutter/flutter/issues/159639 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Flutter is Google's SDK for crafting beautiful, fast user experiences for mobile, web, and desktop from a single codebase. Flutter works with existing code, is used by developers and organizations around the world, and is free and open source.
The Flutter Engine is a portable runtime for hosting Flutter applications. It implements Flutter's core libraries, including animation and graphics, file and network I/O, accessibility support, plugin architecture, and a Dart runtime and compile toolchain. Most developers will interact with Flutter via the Flutter Framework, which provides a modern, reactive framework, and a rich set of platform, layout and foundation widgets.
If you want to run/contribute to Flutter Web engine, more tooling can be found at felt. This is a tool written to make web engine development experience easy.
If you are new to Flutter, then you will find more general information on the Flutter project, including tutorials and samples, on our Web site at Flutter.dev. For specific information about Flutter's APIs, consider our API reference which can be found at the docs.flutter.dev.
Flutter is a fully open source project, and we welcome contributions. Information on how to get started can be found at our contributor guide.