-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
flutter/engine
#34496Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
In current implementation, FlutterViewController will initiate an animation when removing the existing splash screen view. When this is done explicitly in code by flutterViewController.splashScreenView = nil, there is a high chance (~90%) that the associated animation causes app crash.
A sample stack trace looks like below, showing a suspicious early-release of handler block:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x0000000102588657 objc_msgSend + 23
1 libsystem_blocks.dylib 0x00000001051e1b92 _Block_object_assign + 205
2 io.flutter.flutter 0x000000011a4ea1ea __copy_helper_block_e8_32o40b + 31
3 libsystem_blocks.dylib 0x00000001051e1924 _Block_copy + 104
4 com.apple.UIKitCore 0x0000000109cef9a2 +[UIViewAnimationBlockDelegate animationBlockDelegateWithDuration:options:start:completion:] + 221
5 com.apple.UIKitCore 0x0000000109cc141f -[UIViewAnimationState setupWithDuration:delay:view:options:factory:parentState:start:completion:] + 691
6 com.apple.UIKitCore 0x0000000109cf03a5 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 505
7 com.apple.UIKitCore 0x0000000109cf0931 +[UIView(UIViewAnimationWithBlocks) animateWithDuration:animations:completion:] + 86
8 io.flutter.flutter 0x000000011a4ea0e5 -[FlutterViewController removeSplashScreenView:] + 186
A minimum reproduce can be done by adding the following code block in a native iOS view controller:
- (void)fooNativeEventHandler {
FlutterEngine *engine = [[FlutterEngine alloc] initWithName:@"engine" project:nil];
[engine runWithEntrypoint:nil];
FlutterViewController *flutterViewController =
[[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil];
flutterViewController.splashScreenView = [[UIView alloc] init];
[self presentViewController:flutterViewController animated:YES completion:nil];
dispatch_time_t triggerTime = dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC);
dispatch_after(triggerTime, dispatch_get_main_queue(), ^{
flutterViewController.splashScreenView = nil;
}
agordeev and fzyzcjy
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version