Always initialize the _weakFactory in FlutterViewController (flutter/engine#32395)

Fixes https://github.com/flutter/flutter/issues/101209
This commit is contained in:
Jason Simmons
2022-04-04 12:56:35 -07:00
committed by GitHub
parent e42a0ee5ac
commit a0b860283e

View File

@@ -195,6 +195,7 @@ typedef enum UIAccessibilityContrast : NSInteger {
project = [[[FlutterDartProject alloc] init] autorelease];
}
FlutterView.forceSoftwareRendering = project.settings.enable_software_rendering;
_weakFactory = std::make_unique<fml::WeakPtrFactory<FlutterViewController>>(self);
auto engine = fml::scoped_nsobject<FlutterEngine>{[[FlutterEngine alloc]
initWithName:@"io.flutter"
project:project
@@ -206,7 +207,6 @@ typedef enum UIAccessibilityContrast : NSInteger {
}
_viewOpaque = YES;
_weakFactory = std::make_unique<fml::WeakPtrFactory<FlutterViewController>>(self);
_engine = std::move(engine);
_flutterView.reset([[FlutterView alloc] initWithDelegate:_engine opaque:self.isViewOpaque]);
[_engine.get() createShell:nil libraryURI:nil initialRoute:initialRoute];