Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when FlutterFragmentActivity is recreated with an existing FlutterFragment #25770

Merged
merged 3 commits into from Apr 27, 2021

Conversation

xster
Copy link
Member

@xster xster commented Apr 26, 2021

Fixes b/186281005. I broke it in https://github.com/flutter/engine/pull/25395/files#diff-893547c230a70f1b0618f0b79a56c67d8506f0983a5a92b819f13c1071fd7d84R591 since there's an edge case where that method is called before the FlutterFragmentActivity figures out which FlutterFragment it contains in scenarios where the FlutterFragmentActivity is destroyed (such as during reconfiguration) but the FlutterFragment in the fragment manager is not.

This PR moves the restore of the existing fragment earlier in the FlutterFragmentActivity recreation process.

@xster xster requested a review from blasten April 26, 2021 21:19
@google-cla google-cla bot added the cla: yes label Apr 26, 2021
@xster xster requested review from gaaclarke and GaryQian and removed request for blasten April 26, 2021 21:20
static class FlutterFragmentActivityWithProvidedEngine extends FlutterFragmentActivity {
int engineCreated = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/engineCreated/numberOfEnginesCreated

@xster xster added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Apr 27, 2021
@xster xster merged commit dbd622c into flutter:master Apr 27, 2021
@xster xster deleted the fragment-null branch April 27, 2021 05:23
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes platform-android waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
2 participants