diff --git a/.cirrus.yml b/.cirrus.yml index a4fc4a3145a34..78043f0c0acff 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,4 +1,4 @@ -gcp_credentials: ENCRYPTED[!48cff44dd32e9cc412d4d381c7fe68d373ca04cf2639f8192d21cb1a9ab5e21129651423a1cf88f3fd7fe2125c1cabd9!] +gcp_credentials: ENCRYPTED[!cc769765170bebc37e0556e2da5915ca64ee37f4ec8c966ec147e2f59578b476c99e457eafce4e2f8b1a4e305f7096b8!] # LINUX task: diff --git a/DEPS b/DEPS index 9e86ff60ee5ec..8774d68505369 100644 --- a/DEPS +++ b/DEPS @@ -39,7 +39,7 @@ vars = { # Dart is: https://github.com/dart-lang/sdk/blob/main/DEPS. # You can use //tools/dart/create_updated_flutter_deps.py to produce # updated revision list of existing dependencies. - 'dart_revision': '3d2629cd0310df74bdf260d828ed3c75f25db889', + 'dart_revision': '1278bd5adb6a857580f137e47bc521976222f7b9', # WARNING: DO NOT EDIT MANUALLY # The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py diff --git a/ci/licenses_golden/licenses_third_party b/ci/licenses_golden/licenses_third_party index 768043862d2a4..8c0f7e7435efa 100644 --- a/ci/licenses_golden/licenses_third_party +++ b/ci/licenses_golden/licenses_third_party @@ -1,4 +1,4 @@ -Signature: fbed5705076e0a8ed5942eaed257e0bc +Signature: a92ff326020b0e5d29148bd8e830fb6c UNUSED LICENSES: diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 59dbefc9e98bb..1e44a6d3fc6b7 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -276,6 +276,11 @@ - (void)setupNotificationCenterObservers { name:UIApplicationWillResignActiveNotification object:nil]; + [center addObserver:self + selector:@selector(applicationWillTerminate:) + name:UIApplicationWillTerminateNotification + object:nil]; + [center addObserver:self selector:@selector(applicationDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification @@ -790,6 +795,11 @@ - (void)applicationWillResignActive:(NSNotification*)notification { [self goToApplicationLifecycle:@"AppLifecycleState.inactive"]; } +- (void)applicationWillTerminate:(NSNotification*)notification { + [self goToApplicationLifecycle:@"AppLifecycleState.detached"]; + [self.engine destroyContext]; +} + - (void)applicationDidEnterBackground:(NSNotification*)notification { TRACE_EVENT0("flutter", "applicationDidEnterBackground"); [self surfaceUpdated:NO]; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm index a06d19bbcfaf0..82ab3ff3c0065 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm @@ -124,6 +124,8 @@ - (void)handlePressEvent:(FlutterUIPressProxy*)press - (void)scrollEvent:(UIPanGestureRecognizer*)recognizer; - (void)updateViewportMetrics; - (void)onUserSettingsChanged:(NSNotification*)notification; +- (void)applicationWillTerminate:(NSNotification*)notification; +- (void)goToApplicationLifecycle:(nonnull NSString*)state; @end @interface FlutterViewControllerTest : XCTestCase @@ -167,6 +169,20 @@ - (void)testViewDidDisappearDoesntPauseEngineWhenNotTheViewController { OCMReject([viewControllerMock surfaceUpdated:[OCMArg any]]); } +- (void)testAppWillTerminateViewDidDestroyTheEngine { + FlutterEngine* mockEngine = OCMPartialMock([[FlutterEngine alloc] init]); + [mockEngine createShell:@"" libraryURI:@"" initialRoute:nil]; + FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:mockEngine + nibName:nil + bundle:nil]; + id viewControllerMock = OCMPartialMock(viewController); + OCMStub([viewControllerMock goToApplicationLifecycle:@"AppLifecycleState.detached"]); + OCMStub([mockEngine destroyContext]); + [viewController applicationWillTerminate:nil]; + OCMVerify([viewControllerMock goToApplicationLifecycle:@"AppLifecycleState.detached"]); + OCMVerify([mockEngine destroyContext]); +} + - (void)testViewDidDisappearDoesPauseEngineWhenIsTheViewController { id lifecycleChannel = OCMClassMock([FlutterBasicMessageChannel class]); FlutterEnginePartialMock* mockEngine = [[FlutterEnginePartialMock alloc] init];