From d9d338d1e3a5df96ba35aeb5fbcc8e80218f2b09 Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Tue, 17 Mar 2020 12:00:13 -0700 Subject: [PATCH 1/4] Added a log message when sharing a FlutterEngine across multiple FlutterViewControllers. --- .../darwin/ios/framework/Source/FlutterViewController.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 6deed5f8104d7..cbb63048b1020 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -144,6 +144,11 @@ - (instancetype)initWithEngine:(FlutterEngine*)engine self = [super initWithNibName:nibName bundle:nibBundle]; if (self) { _viewOpaque = YES; + if (engine.viewController) { + FML_LOG(ERROR) << "Attempting to share a FlutterEngine across multiple " + "live FlutterViewControllers. This is an unsupported flow and will likely " + "cause unexpected results and/or crashes."; + } _engine.reset([engine retain]); _engineNeedsLaunch = NO; _flutterView.reset([[FlutterView alloc] initWithDelegate:_engine opaque:self.isViewOpaque]); From e72d74e3271d40081200a1d74b91b065c8f39010 Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Tue, 17 Mar 2020 12:55:06 -0700 Subject: [PATCH 2/4] formatter --- .../darwin/ios/framework/Source/FlutterViewController.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index cbb63048b1020..c937b36268c54 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -146,8 +146,8 @@ - (instancetype)initWithEngine:(FlutterEngine*)engine _viewOpaque = YES; if (engine.viewController) { FML_LOG(ERROR) << "Attempting to share a FlutterEngine across multiple " - "live FlutterViewControllers. This is an unsupported flow and will likely " - "cause unexpected results and/or crashes."; + "live FlutterViewControllers. This is an unsupported flow and will likely " + "cause unexpected results and/or crashes."; } _engine.reset([engine retain]); _engineNeedsLaunch = NO; From d7fba83dcf21fd2ac6dbe6d8542449519b01705d Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Wed, 18 Mar 2020 10:59:31 -0700 Subject: [PATCH 3/4] updated message --- .../darwin/ios/framework/Source/FlutterViewController.mm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index c937b36268c54..61cce6a590615 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -145,9 +145,12 @@ - (instancetype)initWithEngine:(FlutterEngine*)engine if (self) { _viewOpaque = YES; if (engine.viewController) { - FML_LOG(ERROR) << "Attempting to share a FlutterEngine across multiple " - "live FlutterViewControllers. This is an unsupported flow and will likely " - "cause unexpected results and/or crashes."; + FML_LOG(ERROR) << "The supplied FlutterEngine " << [[engine description] UTF8String] << " " + " is already used with FlutterViewController instance " << + [[engine.viewController description] UTF8String] << + ". One instance of the FlutterEngine can only be attached to one " + "FlutterViewController at a time. Set FlutterEngine.viewController " + "to nil before attaching it to another FlutterViewController."; } _engine.reset([engine retain]); _engineNeedsLaunch = NO; From 9a387cb3b596082dd35bfbdc82a9f8f07794979b Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Mon, 23 Mar 2020 10:31:16 -0700 Subject: [PATCH 4/4] ran formatter --- .../darwin/ios/framework/Source/FlutterViewController.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 61cce6a590615..6e7e8c495828d 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -145,10 +145,10 @@ - (instancetype)initWithEngine:(FlutterEngine*)engine if (self) { _viewOpaque = YES; if (engine.viewController) { - FML_LOG(ERROR) << "The supplied FlutterEngine " << [[engine description] UTF8String] << " " - " is already used with FlutterViewController instance " << - [[engine.viewController description] UTF8String] << - ". One instance of the FlutterEngine can only be attached to one " + FML_LOG(ERROR) << "The supplied FlutterEngine " << [[engine description] UTF8String] + << " is already used with FlutterViewController instance " + << [[engine.viewController description] UTF8String] + << ". One instance of the FlutterEngine can only be attached to one " "FlutterViewController at a time. Set FlutterEngine.viewController " "to nil before attaching it to another FlutterViewController."; }