From 1cfac108ff064489a592f34a5add9f064ed61896 Mon Sep 17 00:00:00 2001 From: Matej Knopp Date: Wed, 7 Aug 2024 20:24:22 +0200 Subject: [PATCH] Fix FlutterMetalLayer testDealloc flakiness on iOS 18 --- .../darwin/ios/framework/Source/FlutterMetalLayerTest.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterMetalLayerTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterMetalLayerTest.mm index 034ae62115a4b..efab8b6ea921e 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterMetalLayerTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterMetalLayerTest.mm @@ -283,8 +283,11 @@ - (void)testDealloc { [compositor commitTransaction]; [self removeMetalLayer:layer]; + } + CFTimeInterval start = CACurrentMediaTime(); + while (weakLayer != nil && CACurrentMediaTime() - start < 1) { // Deallocating the layer after removing is not synchronous. - CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1, YES); + CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.01, YES); } XCTAssertNil(weakLayer);