Open zhoujun951236 opened 5 months ago
public required init(initRoute: String) { let singleEngine = BTOnlineConfig.MobileSwitch.boolValue(function: "FlutterSetting", forKey: "enableSingleEngine") if !singleEngine {// wait https://github.com/flutter/flutter/issues/127168 let groupOptions = FlutterEngineGroupOptions() groupOptions.entrypoint = entrypoint groupOptions.initialRoute = initRoute groupOptions.entrypointArgs = [FlutterEngineBinding.deviceInfo()] groupOptions.libraryURI = nil engine = FlutterContainerManager.shared.group.makeEngine(with: groupOptions) }else{ engine.run(withEntrypoint: entrypoint, libraryURI: nil, initialRoute: initRoute, entrypointArgs: [FlutterEngineBinding.deviceInfo()]) }
super.init()
GeneratedPluginRegistrant.register(with: engine)
channel = FlutterMethodChannel(name: channelName,
binaryMessenger: engine.binaryMessenger)
let factory = FlutterNativeViewFactory(messenger: engine.binaryMessenger)
engine.registrar(forPlugin: "plugin_name1")!.register(factory, withId: "platform-view-type1")
}
This is how I registered on the ios platform
dart:
if (Platform.isIOS) {
platformView = UiKitView(
viewType: 'platform-view-type1',
layoutDirection: TextDirection.ltr,
creationParams: creationParams,
creationParamsCodec: const JSONMessageCodec(),
gestureRecognizers: Set()..add(Factory
Hi @zhoujun951236 Do you use the complete sample project I shared at https://github.com/flutter/flutter/issues/127168#issuecomment-1554530173?
I just retried running it but couldn't reproduce the crash, it works as expected on the latest Flutter 3.22.1.
If you have modified the sample code, please share the updated one here (a GitHub repo or compressed sample project). Thanks!
I'm sorry maybe I'm not describing it accurately, there's a missing link in your video, which is that the PlatformViewPage needs to push another PlatformViewPage and then pop back to the previous page
sorry,I realized that there might be a problem with my flutter code and I closed it. #127168 Already fixed the problem with multi-tier pages Platformview
@zhoujun951236 Do you still experience this issue?
I stabilized a reproduction of this crash and also provided a demo
https://github.com/flutter/flutter/assets/6309671/16124568-2001-4382-8fac-c2e687c9bff2
Steps are like this, the first step first click on the model_2 button, then click on the “flutter vc inner jumpto page”, then click on the "flutter vc inner pop", the interface pop and then click on this "flutter vc inner pop"
My iphone is iPhone 11 with system version 15.1
Thanks, I can reproduce the crash on my end using your given sample code above: https://github.com/zhoujun951236/testFlutterPlatformView (checked on iPhone 15 Pro iOS 17.4 emulator).
Crash output log: https://pastebin.com/biRjprir
3 Flutter 0x10accd1ff fml::KillProcess() + 9
4 Flutter 0x10accd1f6 fml::LogMessage::~LogMessage() + 378
5 Flutter 0x10acd0c1e fml::SharedThreadMerger::DecrementLease(void*) + 272
6 Flutter 0x10acd0711 fml::RasterThreadMerger::DecrementLease() + 95
7 Flutter 0x10ae17035 flutter::Rasterizer::DoDraw(std::_fl::unique_ptr<flutter::FrameTimingsRecorder, std::_fl::default_delete<flutter::FrameTimingsRecorder>>, std::_fl::vector<std::_fl::unique_ptr<flutter::LayerTreeTask, std::_fl::default_delete<flutter::LayerTreeTask>>, std::_fl::allocator<std::_fl::unique_ptr<flutter::LayerTreeTask, std::_fl::default_delete<flutter::LayerTreeTask>>>>) + 551
cc @eggfly who worked on this thread merging code a few years ago.
cc @hellohuanlin
I found that adding canpop prevents the crash
Steps to reproduce
When I use multi-engine mode A navigation stack with multiple sub-surfaces all have a FlutterNativeView with the same registration type, e.g. B->C, C page pops back to B, crash. When I use single engine mode then everything is fine
Expected results
no crash
Actual results
crash
Thread 1: signal SIGABRT
Code sample
Code sample
```swift if !singleEngine {// wait “https://github.com/flutter/flutter/issues/127168” let groupOptions = FlutterEngineGroupOptions() groupOptions.entrypoint = entrypoint groupOptions.initialRoute = initRoute groupOptions.entrypointArgs = [FlutterEngineBinding.deviceInfo()] groupOptions.libraryURI = nil engine = FlutterContainerManager.shared.group.makeEngine(with: groupOptions) }else{ engine.run(withEntrypoint: entrypoint, libraryURI: nil, initialRoute: initRoute, entrypointArgs: [FlutterEngineBinding.deviceInfo()]) } ```Screenshots or Video
Screenshots / Video demonstration
[Upload media here]Logs
Logs
```console [Paste your logs here] ```Flutter Doctor output
Doctor output
```console flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.22.1, on macOS 14.4.1 23E224 darwin-arm64, locale zh-Hans-CN) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4) [✓] Xcode - develop for iOS and macOS (Xcode 15.4) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.2) [✓] VS Code (version 1.89.1) [✓] Connected device (4 available) ```I found version:3.16.5,3.19.5 also have this crash