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 the issue with crash on process restore #6997

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

abdrasulov
Copy link
Member

#6843

There is a case when the app process is killed and restored by Android OS. When the app is restored it tries to restore all fragments. But the navController is not getting restored and it contains single back stack entry, which is mainFragment.

So if user was in the page like TokenBalanceFragment or TransactionInfoFragment, those fragments are restored. Since they do not get expected data, they call navController.popBackStack(). It results in popping off the single mainFragment of the back stack. And the MainFragment tries to create TransactionsViewModel using the mainFragment back stack entry. But the nav controller back stack is empty. That is why it crashes app.

Fixed issue by ensuring that those fragments closes themselves if needed.

There is a case when the app process is killed and restored by Android OS. When the app is restored it tries to restore all fragments. But the navController is not getting restored and it contains single back stack entry, which is mainFragment.

So if user was in the page like TokenBalanceFragment or TransactionInfoFragment, those fragments are restored. Since they do not get expected data, they call `navController.popBackStack()`. It results in popping off the single mainFragment of the back stack. And the MainFragment tries to create TransactionsViewModel using the mainFragment back stack entry. But the nav controller back stack is empty. That is why it crashes app.

Fixed issue by ensuring that those fragments closes themselves if needed.
@abdrasulov abdrasulov merged commit cc23aa9 into version/0.38 Feb 1, 2024
1 check passed
@abdrasulov abdrasulov deleted the fix-crash-on-app-restore branch February 1, 2024 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants