mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Keep engine alive if VC is not deallocated (#7544)
This commit is contained in:
parent
88fee0804c
commit
2123d3a569
@ -144,13 +144,15 @@
|
||||
FML_DCHECK(self.iosPlatformView);
|
||||
_viewController = [viewController getWeakPtr];
|
||||
self.iosPlatformView->SetOwnerViewController(_viewController);
|
||||
if (!viewController && !_allowHeadlessExecution) {
|
||||
[self maybeSetupPlatformViewChannels];
|
||||
}
|
||||
|
||||
- (void)notifyViewControllerDeallocated {
|
||||
if (!_allowHeadlessExecution) {
|
||||
[self resetChannels];
|
||||
|
||||
_shell.reset();
|
||||
_threadHost.Reset();
|
||||
} else {
|
||||
[self maybeSetupPlatformViewChannels];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
- (FlutterTextInputPlugin*)textInputPlugin;
|
||||
- (void)launchEngine:(NSString*)entrypoint libraryURI:(NSString*)libraryOrNil;
|
||||
- (BOOL)createShell:(NSString*)entrypoint libraryURI:(NSString*)libraryOrNil;
|
||||
- (void)notifyViewControllerDeallocated;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -430,6 +430,7 @@
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[_engine.get() notifyViewControllerDeallocated];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user