Skip to content

Do not trigger fragment change when the activity was already closed#10853

Merged
malinajirka merged 3 commits intodevelopfrom
fix/crash_in_wp_main_navigation_view
Nov 27, 2019
Merged

Do not trigger fragment change when the activity was already closed#10853
malinajirka merged 3 commits intodevelopfrom
fix/crash_in_wp_main_navigation_view

Conversation

@planarvoid
Copy link
Copy Markdown
Contributor

Fixes #10852

I've investigated this issue deeply but I couldn't find how it could be happening. It seems that the system gets the bottom nav click after onSaveInstanceState is called on the main activity. This shouldn't be possible. I think in this case it's safe to call commitAllowingStateLoss because we don't mind we lose the bottom nav position when the activity is being killed. It's better than crashing.

To test:

  • Smoke test the bottom navigation

PR submission checklist:

  • I have considered adding unit tests where possible.

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@planarvoid planarvoid added this to the 13.8 milestone Nov 26, 2019
@planarvoid planarvoid self-assigned this Nov 26, 2019
@peril-wordpress-mobile
Copy link
Copy Markdown

You can test the changes on this Pull Request by downloading the APK here.

Copy link
Copy Markdown
Contributor

@malinajirka malinajirka left a comment

Choose a reason for hiding this comment

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

Thanks Vojta! ;) As we discussed I'm not a big fan of "commitAllowingStateLoss", but it seems reasonable to use it for this case. 🚢

@malinajirka malinajirka merged commit 244faa2 into develop Nov 27, 2019
@malinajirka malinajirka deleted the fix/crash_in_wp_main_navigation_view branch November 27, 2019 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash in Bottom navigation: Can not perform this action after onSaveInstanceState

2 participants