diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index 2711e2e9b82..83551d2aed0 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -203,6 +203,11 @@ NSString* const FlutterDefaultDartEntrypoint = nil; - (void)notifyViewControllerDeallocated { if (!_allowHeadlessExecution) { [self destroyContext]; + } else { + flutter::PlatformViewIOS* platform_view = [self iosPlatformView]; + if (platform_view) { + platform_view->SetOwnerViewController({}); + } } _viewController.reset(); }