-
Notifications
You must be signed in to change notification settings - Fork 6k
Added a log message when sharing a FlutterEngine across multiple FlutterViewControllers. #17186
Conversation
FlutterViewControllers.
Add to https://cs.opensource.google/flutter/engine/+/master:shell/platform/darwin/ios/framework/Headers/FlutterViewController.h;l=59 as well. e.g. if you give me |
@@ -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 " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The supplied FlutterEngine << engine << is already used with FlutterViewController instance << engine.ViewController <<. 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.
While on this topic, should we do this automatically in the FlutterViewController's dealloc too? Unsetting the engine's viewController property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While on this topic, should we do this automatically in the FlutterViewController's dealloc too? Unsetting the engine's viewController property.
That already happens, niling out an engine's view controller with their view controller is dealloc'd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message updated.
landing, previously only failed formatting, now it's passing. |
…ple FlutterViewControllers. (flutter/engine#17186)
…ple FlutterViewControllers. (flutter/engine#17186)
…ple FlutterViewControllers. (flutter/engine#17186)
issue: flutter/flutter#52455