Fix FlutterMetalLayer testDealloc flakiness on iOS 18 (flutter/engine#54403)

Fixes https://github.com/flutter/flutter/issues/152990

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
Matej Knopp
2024-08-08 18:39:17 +02:00
committed by GitHub
parent 753fd42815
commit 4d9360ac5b

View File

@@ -283,8 +283,11 @@
[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);